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 17, 2019 in Selenium by Vaishnavi
• 1,180 points
7,032 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, 2019 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 27, 2018 in Selenium by Trisha
248 views
0 votes
1 answer

What is the actual conflict while performing click() on web element, and getting an error like element is not clickable at point(x,y)?

Hey @sastry, the error Element is not clickable ...READ MORE

answered Nov 27, 2019 in Selenium by Sirajul
• 59,170 points
2,209 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 28, 2018 in Selenium by nsv999
• 5,500 points
23,590 views
0 votes
2 answers

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,500 points
8,131 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
7,240 views
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,890 points
4,982 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
6,195 views
+1 vote
2 answers

How can I delete an element in Selenium using Python?

You can directly delete the node using ...READ MORE

answered Sep 14, 2019 in Selenium by tonystark
• 500 points
15,002 views
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, 2019 in Selenium by Surya
• 970 points
800 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP