python - 从鼠标悬停选项卡单击硒
问题描述
我用了
quotes = browser.find_element_by_id('CQ')
quotes.click()
但它回来了
Unable to locate element: {"method":"id","selector":"CQ"}
也许我的功能/参数有误。
解决方案
由于页面加载的性质,有时需要 Webdriver 等待。尝试等到元素首先显示/启用,然后再单击它。用于 WebDriver 等待的 Python Selenium 文档:http: //selenium-python.readthedocs.io/waits.html。
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 10)
element = wait.until(EC.visibility_of_element_located((By.ID, 'someid')))
推荐阅读
- android - com.beardedhen.androidbootstrap.BootstrapEditText 类型定义了多次
- python - 用 SQLalchemy 映射 MSSQL 中预先存在的表的方法是什么
- python - 在 Python 中调用对象时的数据
- pandas - 用于读取 SAS .xpt 文件的 pandas.read_sas() 不适用于存储在 Google Cloud Storage (GCS) 中的文件
- ios - 在 Ios/Swift 5 中拦截 websocket HTTP 升级请求 - URLProtocol
- sql - 在单个查询中包含查询列的计数
- multithreading - 带有 Keras API 的 Tensorflow 2.0 是线程安全的吗?
- javascript - 在javascript中的json中获取方括号而不是花括号
- php - php数组排序未找到任何解决方案
- python - Python Tkinter - 选项卡类