The id for webelement is mainPage:mainForm:j_id152:locationsPage:locsBlock:slTable:0:locNamePanel
The problem is:
To find a WebElement. When hovered upon that webelement, Edit link comes up which needs to be clicked.
Tried this approach:
- Scrolling the webpage down (just in case)
- Finding the webElement by id
- Getting the X and Y coordinates for that webElement
- Using mouseover
Following is the code:
//Finding the Webelement coordinates
int X= driver.findElement(By.id("mainPage:mainForm:j_id152:locationsPage:locsBlock:slTable:0:locNamePanel")).getLocation().getX();
int Y= driver.findElement(By.id("mainPage:mainForm:j_id152:locationsPage:locsBlock:slTable:0:locNamePanel")).getLocation().getY();
System.out.println("The coordinates are:-" +X +"---"+Y);
Robot robot = new Robot();
//Doing a mouse over for the X and Y coordinates
robot.mouseMove(X, Y);
//Clicking the Edit button
driver.findElement(By.id("mainPage:mainForm:j_id152:locationsPage:locsBlock:slTable:0:j_id207")).click();
Issue:
The X and Y coordinates are coming back (not sure if those are for the WebElement that I am looking for). But, the mouseover isn't working.
Why wouldn't you do something like the following:
This should accomplish the same thing without having to rely on the Java Robot classes.