URL - https://www.saucedemo.com/inventory-item.html?id=4
如何访问这个Xpath上的$标记?
//*[@id="inventory_item_container"]/div/div/div[2]/div[3]/text()[1]
我在 IntelliJ 上遇到错误:
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="cart_contents_container"]/div/div[1]/div[3]/div[2]/div[2]/div/text()[1]"}
(Session info: chrome=126.0.6478.185)
预计如下
actualText = driver.findElement(By.xpath("//*[@id=\"inventory_item_container\"]/div/div/div[2]/div[2]")).getText();
对于这个实际文本应该是 = $.