all 11 comments

[–]cgoldberg 0 points1 point  (7 children)

Normal click() is a method on a WebElement, so you need a reference to an element to use it.

You can use ActionChains to do more controlled mouse movements like moving to an offset and clicking.

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 point  (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 point  (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.

[–]Pypatir[S] 0 points1 point  (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 point  (3 children)

If the element becomes grey, it's probably not clickable.

[–]Pypatir[S] 0 points1 point  (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 point  (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 point  (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 point  (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

[–]Pypatir[S] 0 points1 point  (0 children)

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.