I want to click on random X,Y element of a page which has google map in 85% of space,using webDriver.Is there any function provided by webdriver.Googling told me this solution .But clickAt() expects an element but I just want to click on page.Can Robot API of AWT be of any help.It seems very basic functionality of webdriver but due to inexperience I couldn't find any working solution.
Asked
Active
Viewed 3,655 times
1
-
Coordinate clicking is generally a bad idea because it is imprecise and will lead to test instability. What are you actually trying to click on? The best option when working with google maps is generally hook into the google maps API and use JavaScript to trigger events (Selenium has problems with – Ardesco Feb 21 '13 at 17:08
2 Answers
1
I know for sure a solution that works, but will need some carefulness in installation (at least on Linux). A SikuliFirefoxDriver
exists that leverages the webdriver API with the awesome OpenCV tooling of Sikuli
That allows you to use webdriver when you want, and add Sikuli image recognition and clicking when you need it. Very powerful to automate Google Maps
You can find an example here

Grooveek
- 10,046
- 1
- 27
- 37
0
Have you ever tried the Action
interface?
int xOffset, yOffset;
Actions actions = new Actions(this.drivy);
Action move = actions.moveByOffset(xOffset, yOffset).build();
move.perform();
The only problem is, that the offset is relative to the last cursor position.
May I ask what you need that for?
I wouldn't want to use that (and don't recommend to use it).
What if the size of your browser changes?
What if you change your resolution?
Edit:
Maybe this could help you too: Selenium tests for Google maps

Community
- 1
- 1

Franz Ebner
- 4,951
- 3
- 39
- 57
-
Haven't tried it yet.Actually in 85% of my page map appears but I am to click on any of map's coordinate.Can X and Y offset be given in % to a avoid resolution issue? – sandy Feb 18 '13 at 17:20
-
If you wrap that in a method and do the math on your own, this shouldn't be a problem ;) How can you test anything within that map? – Franz Ebner Feb 19 '13 at 08:52
-
Don't want to do testing of map as of now.Need to just click on random coordinate on map. – sandy Feb 19 '13 at 08:55