Clicking x,y coordinates in selenium doesn’t work when done 1 more time or more times?

I am using selenium on python…
My problem is as follows:

  • When I open the web page, load it, find an element and click on it, it will bring up the second tab.

  • In the 2nd tab, I have x and y coordinates… In this first operation when I click on x,y it still works normally (still selenium), but when I close the second tab 2 => go back to tab 1, click on the element to open the second tab, click on the x,y coordinates but it doesn’t work and selenium reports an error like this (first click on tab 2 is still ok but the next time 2 is an error message):
    When clicking on the coordinates for the second time in tab 2
    Code:

    ac = ActionChains(driver) ac.move_by_offset(x_offset,y_offset) ac.click().perform()
    I use chrome version Version 116.0.5845.141 (Official Build) (64-bit)

I have tried many times, but the second time I open tab 2, I still can’t click on the x,y coordinates.
I hope someone has encountered the same error and found a fix

  • the question needs sufficient code for a minimal reproducible example

    – 

  • You mentioned “coordinates” several times in your question, but ac.move_by_offset(x_offset,y_offset) isn’t really coordinates. It’s an offset from the current mouse position. I’m guessing that offset would have moved the mouse off the screen, and so you got the error.

    – 

Leave a Comment