我有一个更新按钮,在python中,botı想单击此按钮,但ı尝试了许多选项但不工作ı无法通过XPath定位元素。请帮帮我?谢谢你的帮助
注意:我需要使用文本“更新”来定位,因为网页上有很多按钮
<span class="a-spacing-top-small">
<span class="a-button a-button-primary a-button-small sc-update-link" id="a-autoid-2">
<span class="a-button-inner">
<a href="javascript:void(0);" data-action="update" class="a-button-text" role="button" id="a-autoid-2-announce" style="">Update
<span class="aok-offscreen">Nike Academy 18 Rain Jacket Men's (Obsidian, M)</span>
</a>
</span>
</span>
</span>
所需元素是启用了JavaScript的元素,因此要在元素上定位/
click()
,您需要为element_to_be_clickable()
诱导WebDriverWait,并且可以使用以下任一Locator Strategies:使用
CSS_SELECTOR
:使用
XPATH
:注意:您必须添加以下导入:
这应该起作用:
其中driver是您的driver实例
相关问题 更多 >
编程相关推荐