我想將機器人中的xpath轉換爲python代碼。我想在機器人下面的XPath轉換爲Python代碼將Robot Framework xPath轉換爲等效的Selenium Python。
此作品在機器人:
:xpath=(//th[@class="picker-switch"])[2]
我在python
self._driver.find_element_by_xpath("//th[@class='picker-switch'][2]")
導致以下錯誤嘗試
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//th[@class='datepicker-switch'][2]"}
and
self._driver.find_element_by_xpath("//th[@class='picker-switch']")[2]
引起:
'WebElement' object does not support indexing
「不要工作」是一個相當廣泛的領域。你能向我們提供錯誤信息嗎? –
我添加了錯誤。 – Dani