我的任务是编写一个解析器以单击网站上的一个按钮,但我只能单击其中一个按钮而遇到问题。以下代码适用于除一个按钮之外的所有按钮。
这是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()
相关分类