简体   繁体   English

需要xpath:position和xpath:attribute

[英]Need of xpath:position & xpath:attribute

I am working on a record tool (in JavaScript) similar to Selenium. 我正在使用类似于Selenium的记录工具(使用JavaScript)。 For Playback I need the XPath position and its attributes (see below screenshot from Selenium). 对于播放,我需要XPath位置及其属性(请参见下面的Selenium屏幕截图)。

How can I find the position and attributes in JavaScript? 如何在JavaScript中找到位置和属性?

硒工具片段供参考

You can use css selector: 您可以使用CSS选择器:

document.querySelector("li:nth-of-type(4) input[name='leg0']");

or 要么

document.querySelectorAll("li:nth-of-type(4) input[name='leg0']");

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM