how to mouse pointer from one frame to another?

Hi,

I’m facing an issue in moving mouse pointer from one frame to another,as shown in screenshots am able to select an option (User Management] from ‘Administrator ‘ drop down by using mouse hover feature but after selecting and clicking User Management mouse pointer is not able to found the Webelement ‘test1@hcl.’ which is shown in screenshot.
And getting error as  “Unable to locate element: {“method”:”xpath”,”selector”:”.//*[@id=’testuser@hcl.com’]/div[2]/div/img”}”.Below is the code which i used for login and mouse hover function and attached screenshots for reference,expecting quick reply..thanks ton in advance.


package automationFramework;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.Actions;
public class DragDropTestCase {
private static WebDriver driver = null;
public static void main(String[] args) throws InterruptedException {
// Create a new instance of the Firefox driver
driver = new FirefoxDriver();
//Put a Implicit wait, this means that any search for elements on the page could take the time the implicit wait is set for before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://10.154.0.120:8100/MAGNet/login.htm");
// Find the element that's ID attribute is 'account'(My Account)
// driver.findElement(By.xpath(".//*[@id='account']/a")).click();
// Find the element that's ID attribute is 'log' (Username)
// Enter Username on the element found by above desc.
driver.findElement(By.id("userName")).sendKeys("test1@hcl.com");
// Find the element that's ID attribute is 'pwd' (Password)
// Enter Password on the element found by the above desc.
driver.findElement(By.id("password")).sendKeys("Tefilla");
// Now submit the form. WebDriver will find the form for us from the element
driver.findElement(By.xpath(".//*[@id='loginForm']/div[2]/div[1]/a")).click();
// Print a Log In message to the screen
System.out.println(" Login Successfully into MAGNet, now it is the time to Log Off.");
// for selecting User Management option from drop down
WebElement element = driver.findElement(By.linkText("ADMINISTRATOR"));
Actions action = new Actions(driver);
action.moveToElement(element).perform();
WebElement subElement = driver.findElement(By.linkText("User Management"));
action.moveToElement(subElement);
action.click();
action.perform();
//Double click
Actions Useraction = new Actions(driver);
Useraction.doubleClick(driver.findElement(By.xpath(".//*[@id='testuser@hcl.com']/div[2]/div/img")));

Add Comment
5 Answer(s)
RE: how to mouse pointer from one frame to another?
naresh_g7 Train Answered on June 8, 2015.
Add Comment

Naresh,

Is there an iframe involved in the whole process? Can you check the HTML and let us know if there is an iframe?

Virender

Virender Singh Professor Answered on June 8, 2015.
Add Comment

Yes Virender,

You are right there is an iframe when i check HTML..

Naresh G

naresh_g7 Train Answered on June 8, 2015.
Add Comment

you can use the simple code ” driver.switchTo().frame(framename);” to handle the frame

and to move out of frame you can use “driver.switchTo().defaultContent();

Dineshk Train Answered on June 12, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.