with selenium can’t click some hidden element, use driver.execute_script(‘arguments[0].click();’,ele) also didn’t work

  html, javascript, jquery, selenium

use selenium click() can’t click the red one(hidden)

selenium click() means
driver.find_element_by_xpath(r"//*[@id=’container’]/div/img").click()

and use

ele = driver.find_element_by_xpath(r"//*[@id=’container’]/div/img")
driver.execute_script(‘arguments[0].click();’,ele)

can’t click anything. Even when I use console of Chrome for click, it still didn’t work.

but in other pages like google, execute_script can work.
And I find it that if use mouse hover in this elements the pattern will change.

So just hope one way to click all elements, thanks!

Source: Ask Javascript Questions

LEAVE A COMMENT