How can I click at the coordinates without identifying an element?

0 votes
In a part of the Selenium test for a login function, I would like to click a button by identifying its coordinates and make Selenium to click at those specified coordinates. Can this be done without actually identifying the element itself (via id, XPath, etc)?

I also know that there are many more efficient ways to run a click command, but I'm looking for the one which is specifically used for this approach for better user experience.
Jul 16 in Selenium by Vaishnavi
• 1,160 points
46 views

1 answer to this question.

0 votes

Of course, there is a way to do this. You can use the ActionChains API and you can move the mouse over an element, adjust by some offset, and then click at that location. Here's how you do it using WebDriver in Python:

element = find_element_by_selector(selector)
ed = ActionChains(browser)
ed.move_to_element(element).move_by_offset(x_off, y_off).click().perform()

Everybody might just quickly try to dismiss this question but, there are a number of ways to click at a specific location, rather than on any element. This technique would also be valuable for imagemaps as well.

Hope you find this useful. :)

answered Jul 22 by Surya
• 970 points

Related Questions In Selenium

0 votes
1 answer

How can I get cssSelector of an element?

There are two ways as much as ...READ MORE

answered Dec 26, 2018 in Selenium by Trisha
47 views
+2 votes
2 answers

How can I press ENTER key with the execute_script in selenium python?

The below code containing Keys.ENTER might just ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,090 points
6,409 views
0 votes
1 answer

How can I download the *.jar file from http:// seleniumhq.org using selenium WebDriver?

For Selenium Standalone Server use this: profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive"); and ...READ MORE

answered Apr 9, 2018 in Selenium by Martin
• 4,220 points
465 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
558 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
892 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
558 views
+1 vote
2 answers
0 votes
1 answer

How can I automate Google Chrome using Selenium RC?

Chrome is used to launch a special ...READ MORE

answered Mar 6 in Selenium by Surya
• 970 points
95 views