python - 如何使用 selenium webdriver python 单击跨度文本
问题描述
无法通过跨标签内的 selenium Web 驱动程序单击“继续”按钮。
<span style="align-items: center; align-self: center; flex: 1 1 auto; margin: 0px 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
<span>Continue</span>
</span>
解决方案
从技术上讲,您不单击跨度文本,而是单击<span>
带有文本的继续,您可以使用以下解决方案:
driver.find_element_by_xpath("//span/span[contains(.,'Continue')]").click()
推荐阅读
- javascript - 触发后如何修改css动画?
- python - 情绪分析逻辑回归的错误输入形状
- python - 将值返回到 tkinter 接口
- ios - 按钮上有两种颜色(快速)
- python-3.x - 从每行数据框的字符串列表中创建一个新的数据框
- c++ - 如何使用 doxygen 在 markdown 中自动创建指向 C++ 类的链接?
- php - Laravel 7 Vue Dropzone - 无法显示存储中的图像。文件名没有上传到 phpmyadmin
- sapui5 - 私人 UI5 开发
- java - 2D Array number grid with for and if
- python-3.x - 覆盖 __getitem__