selenium ElementNotInteractableException: Element could not be scroll into view

In selenium using python, sometimes there's error:

 ElementNotInteractableException: Element  could not be scroll into view

 

toolpath='//*[@id="hdtb-tls"]'
toolbutton=driver.find_elements_by_xpath(toolpath)[0]
#add here 
toolbutton.click()

在上图第三行处加入toolbutton.location_once_scrolled_into_view 即可

    toolpath='//*[@id="hdtb-tls"]'
    toolbutton=driver.find_elements_by_xpath(toolpath)[0]
    toolbutton.location_once_scrolled_into_view
    toolbutton.click()

 


版权声明:本文为Al_shawn原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。