简体   繁体   English

如果元素没有任何属性,例如id,name,css等,则如何使用JavaFX获取元素的绝对XPath

[英]How to get the absolute XPath for an element using JavaFX, if the element doesn't have any attributes, like id, name, css etc

如果元素不具有id,name,css等任何属性,如何使用JavaFX获取元素的绝对XPath

html/body/tr/td[3]/div[2]/input

If it's parents have any unique properties and it is a single child, you can find it's parent and direct it to its child. 如果它的父母具有任何独特的属性并且是一个独生子女,则可以找到它的父母并将其定向到它的孩子。

html/body/tr/td[@class="classname"]/div[@id="idp"]/input HTML /体/ TR / TD [@类= “类名”] /格[@ ID = “IDP”] /输入

You can also find it's child if that has any unique identifiers and then direct it to its parent, so the xpath would look like 您还可以找到具有唯一标识符的子对象,然后将其定向到其父对象,因此xpath看起来像

// [@id="inputfieldchild"]/parent:: // [@ id =“ inputfieldchild”] /父::

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为一个没有任何唯一 ID 的元素编写 Xpath - Xpath writing for one element which doesn't have any unique id 有没有办法使用Java获取元素的XPath或CSS路径? - Is there any way to get the XPath or CSS path of an element using Java? 获取Web元素的绝对XPath - Get Absolute XPath of Web Element 如何让WebDriver在使用CSS,XPath,标签,链接或元素ID之间进行切换 - How to get webdriver to switch between using css, xpath, tag, link or element id 如何使用硒2定位元素,其中没有唯一的标识符,例如名称,ID - How can I locate an element using selenium 2 which do not have unique identifiers like Name, Id 如何使用没有ID /名称或任何其他唯一标识符的硒来定位元素? - How to locate an element using selenium that does not have id/name or any other unique identifier? 如何使用 id 在 JavaFx 中获取元素? - how do I get an element in JavaFx using an id? 如何通过 xpath 查找具有相同 class、名称等的元素 - How to find element by xpath that has same class, name etc 选择没有特定id,class,xpath等的元素 - Selecting an element with no particular id, class, xpath, etc 无法在Selenium中找到元素尝试过的xpath,name,id,css选择器 - Not able to locate element in Selenium tried xpath,name,id,css selector
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM