How to obtain the page element xpath in various browsers)

Source: Internet
Author: User
Tags xpath

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.