selenium问题集锦

1.绑定点击事件的元素被一个div覆盖,导致直接点击的时候会报错怎么办?

报错:Other element would receive the click: <div>......

解决方法:

加上browser.execute_script('arguments[0].click()', webElement)

加上webElement.click()

案例:

ActionChains(browser).send_keys(Keys.END).perform()
upload=browser.find_element_by_id('uploadphotoids')
browser.execute_script('arguments[0].click()', upload)
upload.click()

PS:这种问题尝试过但是未成功的解决方案有——直接执行js脚本  

猜你喜欢

转载自www.cnblogs.com/ftxy/p/11766607.html