When recording web automation scripts, one of the most troublesome tasks is to locate the elements to be detected.
The difficulty lies in the following two points:
1. if Id positioning is required, developers need to work with each other. Sometimes developers forget to add it. Sometimes, if multiple table nesting occurs, it is difficult to add IDs to dynamically generate unknown quantities.
2. Generally, Dom locating functions or XPath are required without ID. When multiple layers of nesting occur, this will make people crazy.
Is there a tool that allows us to quickly obtain an Element's Xpath?
The answer must be yes!
Demand will certainly drive programmers to develop such things, and those with a communist spirit will be willing to share them.
Google searches, and a tool named x path for free is available soon!
:
Https://chrome.google.com/webstore/detail/lbghbpofdlcecfbpjgmffnkieenjkboi
This tool is a chrome plug-in. After the tool is downloaded and installed, a mark will appear in the upper-right corner of chrome. Click it and click the element to be located. The XPath in the lower-right corner of the element is generated, you can copy it as needed. With this, the positioning becomes a piece of cake, and there is no need to count the table anymore. How is it so cool to use RF and selenium?
The steps are shown in the following figure:
Is there any plug-in like this under Fire Fox? Of course!
That is
Https://addons.mozilla.org/en-US/firefox/addon/firepath/
And
Https://addons.mozilla.org/en-US/firefox/addon/xpath-checker/
For details about the usage, please read this article:
Http://blog.sina.com.cn/s/blog_5aefba9a0100csy8.html
What about IE? Of course there are solutions. However, it seems miserable. Use a complicated Trick
The article is here
Http://blog.sina.com.cn/s/blog_6067dbcb0100ndi4.html
-----------------------------------------
Update 2.2.2.2.14
Link to the xpath Tutorial: http://www.w3school.com.cn/xpath/
----------------------------------------------------
Original article: http://blog.sina.com.cn/s/blog_654c6ec70100v1i2.html