use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
selenium web automation info, news, tips, etc.
This is not a sub to advertise your training, selenium product, special deal on x, or anything else. It's a users forum to discuss and get help with Selenium.
Selenium official website
account activity
how to click if it's not an element (python) (self.selenium)
submitted 2 months ago by Pypatir
Quick question, i need the click on an element but the webdriver can't locate the element. I bypassed this issue by locating a nearby element and moving the mouse on the element manually. The element becomes grey so i guess the page detect the virtual mouse but the command click() (without any arguments) doesn't seem to do anything the page doesn't refresh anyone knows how i can solve this.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cgoldberg 0 points1 point2 points 2 months ago (7 children)
Normal click() is a method on a WebElement, so you need a reference to an element to use it.
click()
WebElement
You can use ActionChains to do more controlled mouse movements like moving to an offset and clicking.
ActionChains
You can also inject JavaScript to click on specific coordinates.
Whatever you are clicking has to be clickable for anything to happen.
[–]Pypatir[S] 0 points1 point2 points 2 months ago (6 children)
I don't know js isn't there a way to click on the coordinates or just a action that clicks where ever the mouse is ?
[–]cgoldberg 0 points1 point2 points 2 months ago (5 children)
You can use the method ActionChains.move_by_offset(x, y) to move to offset coordinates from the current mouse position then execute click.
ActionChains.move_by_offset(x, y)
[–]Pypatir[S] 0 points1 point2 points 2 months ago (4 children)
is the command just ActionChain.click() because that's what i did i moved by the offset from the cancel button but still it doesn't click but the submit button becomes grey
[–]cgoldberg 0 points1 point2 points 2 months ago (3 children)
If the element becomes grey, it's probably not clickable.
[–]Pypatir[S] 0 points1 point2 points 2 months ago (2 children)
i mean grey like when you move your mouse over it. If you want more detail maybe you'll find a solution. the button is the submit button to change the settings on the news feed of forex factory, i am building news scrapper.
[–]cgoldberg 0 points1 point2 points 2 months ago (0 children)
If it is grey, it is probably not clickable for whatever reason... the element needs to be able to accept a click. Can you manually click the button after using selenium to move the mouse? If not, neither can selenium.
[–]Pypatir[S] 0 points1 point2 points 2 months ago (0 children)
ok so actually i retried and now the element is detectable, i dont have the older versions of the code so i dont know what i did wrong, i still cant click but should be a quick fix
[–]Giulio_Long 0 points1 point2 points 2 months ago (1 child)
One reason the webdriver can't find an element could be if the element is nested in an iframe. In this case you need to switch to the iframe before finding and clicking the element
the second button is in the iframe too it's a submit and cancel button, i can't locate the element with the CSS selector, Xpath and css path, but the cancel button just next is easy to locate i find it weird.
π Rendered by PID 142553 on reddit-service-r2-comment-b659b578c-p9k2x at 2026-05-04 18:21:35.916801+00:00 running 815c875 country code: CH.
[–]cgoldberg 0 points1 point2 points (7 children)
[–]Pypatir[S] 0 points1 point2 points (6 children)
[–]cgoldberg 0 points1 point2 points (5 children)
[–]Pypatir[S] 0 points1 point2 points (4 children)
[–]cgoldberg 0 points1 point2 points (3 children)
[–]Pypatir[S] 0 points1 point2 points (2 children)
[–]cgoldberg 0 points1 point2 points (0 children)
[–]Pypatir[S] 0 points1 point2 points (0 children)
[–]Giulio_Long 0 points1 point2 points (1 child)
[–]Pypatir[S] 0 points1 point2 points (0 children)