Java 我在eclipse中遇到了这个xpath错误,我认为xpath是正确的(1/1),但为什么会出现这个错误呢

Java 我在eclipse中遇到了这个xpath错误,我认为xpath是正确的(1/1),但为什么会出现这个错误呢,java,testing,selenium-webdriver,automation,automated-tests,Java,Testing,Selenium Webdriver,Automation,Automated Tests,24“组合式冰箱,带制冰机可翻转门,黑色 您需要对“24后”进行转义,因为它的句柄类似于引号。 试试这个: driver.findElement(By.xpath("//div[contains(text(),'24\" Combination refrigerator w/ ice maker reversib')]")).click(); 谢谢trapzerapzerix问题解决了。。。!!!你犯了什么错误?


24“组合式冰箱,带制冰机可翻转门,黑色
您需要对“24后”进行转义,因为它的句柄类似于引号。 试试这个:

driver.findElement(By.xpath("//div[contains(text(),'24\" Combination refrigerator w/ ice maker reversib')]")).click();

谢谢trapzerapzerix问题解决了。。。!!!你犯了什么错误?