cannot focus element解决方案

If you enconter error "cannot focus element" when using Selenium+Python in Chrome to input value, you can use below code instead:

 

from selenium.webdriver.common.action_chains import ActionChains

element1 = driver.find_element_by_id("inputCtrl0")

ActionChains(driver).click(element1).send_keys("111").perform()

 

posted on 2018-05-21 14:32  Amy_Hu  阅读(449)  评论(0编辑  收藏  举报