首页 > 解决方案 > 如何选择此按钮并单击它?

问题描述

如何使用 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 idclass name 总是出错selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:

有没有人可以帮助我拜托!

标签: python-3.xseleniumselenium-firefoxdriver

解决方案


您也许可以使用find_element_by_partial_link_textorfind_element_by_link_text功能。

尝试使用此链接了解如何使用它。关联


推荐阅读