英文:
I am getting this xpath error in eclipse , i think xpath is correct(1 of 1) but why am getting error
问题
<!-- 开始代码片段: 不隐藏 JS 控制台: 是 使用 Babel: 否 -->
<!-- 语言: HTML -->
<div class="u-grid">
<div class="u-truncate ng-binding ng-isolate-scope" ng-class="" ng-style="" tooltip="" tooltip-truncated="" ng-bind="$ctrl.parent.getProperty($ctrl.field, $ctrl.record)" xpath="1">24" Combination refrigerator w/ ice maker reversible door swing, Black</div>
</div>
<!-- 结束代码片段 -->
xpath:
driver.findElement(By.xpath("//div[contains(text(),'24\" Combination refrigerator w/ ice maker reversib')]")).click();
英文:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<div class="u-grid">
<div class="u-truncate ng-binding ng-isolate-scope" ng-class="" ng-style="" tooltip="" tooltip-truncated="" ng-bind="$ctrl.parent.getProperty($ctrl.field, $ctrl.record)" xpath="1">24" Combination refrigerator w/ ice maker reversible door swing, Black</div>
</div>
<!-- end snippet -->
xpath:
driver.findElement(By.xpath("//div[contains(text(),'24" Combination refrigerator w/ ice maker reversib')]")).click();
答案1
得分: 1
试试这个:
driver.findElement(By.xpath("//div[contains(text(),'24" Combination refrigerator w/ ice maker reversib')]")).click();
英文:
You need to escape the " after 24 because it is handle like a quotation mark.
Try this:
driver.findElement(By.xpath("//div[contains(text(),'24\" Combination refrigerator w/ ice maker reversib')]")).click();
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论