硒元素不可见异常

我的任务是编写一个解析器以单击网站上的一个按钮,但我只能单击其中一个按钮而遇到问题。以下代码适用于除一个按钮之外的所有按钮。


这是html:http: //pastebin.com/6dLF5ru8


这是源html:http: //pastebin.com/XhsedGLb


python代码:


 driver = webdriver.Firefox()  

 ...

 el = driver.find_element_by_id("-spel-nba")

 actions.move_to_element(el)

 actions.sleep(.1)

 actions.click()

 actions.perform()

我收到此错误。


ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with

根据赛富尔,我刚刚尝试等待相同的元素不可见异常:


wait = WebDriverWait(driver, 10)

wait.until(EC.presence_of_element_located((By.XPATH, "//input[contains(@id,'spsel')][@value='nba']"))).click()


皈依舞
浏览 434回答 3
3回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python