python-3.x - 如何选择此按钮并单击它?
问题描述
如何使用 selenium 从列表元素中选择此按钮并单击它?这是html
<li class="ml1 sel">
<a href="#__about.htm" id="about_page" onclick="return menuClick(this);" class="T sel">
<span>about us</span>
</a>
</li>
我尝试使用xpath
css selector
id
但class name
总是出错selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:
有没有人可以帮助我拜托!
解决方案
您也许可以使用find_element_by_partial_link_text
orfind_element_by_link_text
功能。
尝试使用此链接了解如何使用它。关联
推荐阅读
- google-sheets - Google 表格按今天日期过滤
- pandas - 如何在 pivot_table 上有小计?(已经有边距= True)
- highcharts - Highcharts 每个节点的自定义符号和颜色
- c++ - 如何从头开始实现 EventSource (SSE) 服务器端?
- c# - 在 Visual Studio 中编辑的 Unity 脚本在某些行上不提供自动完成功能
- swift - 根据 CollectionView 中的数组计数,部分的数量不起作用
- javascript - 根据值将项目的 JS 数组分组到“其他”组中
- android - Sqlite Adapterposition 如何从 recylerview 中知道 ID
- javascript - 如何在打字稿中强制使用类型实例而不是 typeof
- html - BI每月自动更新HTML中的月份标签