我试图为下面的html标记找到xpath。但无法定位在硒.as我是初学者,我需要一些帮助和建议。获取错误:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@class='react-autosuggest__input react-autosuggest__input--open']"}
(Session info: chrome=73.0.3683.103)
这是HTML元素。你知道吗
<input type="text" autocomplete="off" aria-autocomplete="list" aria-controls="react-autowhatever-1" class="react-autosuggest__input react-autosuggest__input--open" placeholder="From" value="">
我已经尝试了,并为上面的xpathHTML。但是抛出错误也是如此。你知道吗
//*[@class='react-autosuggest__input react-autosuggest__input--open']
我希望上面xpath的输出能够在selenium中定位元素,但实际上我得到了一个错误。你知道吗
尝试使用WebDriverWait,只设置较长的等待时间,例如:
元素似乎是React元素,因此要定位元素,必须导出WebDriverWait,才能单击元素,并且可以使用以下任一解决方案:
使用
CSS_SELECTOR
:使用
XPATH
:注意:必须添加以下导入:
相关问题 更多 >
编程相关推荐