官术网_书友最值得收藏!

An example traversal

The element retrieval and traversal can be done quite easily by what is known as a browsers console. In all the three browsers, the console can be invoked by pressing the F12 key on the keyboard. In Chrome, the Elements tab will help in finding the XPath. One can traverse back and forth in the DOM using '/..' and ('//' or '/'). Let's see what the Chrome console looks like.

The following snapshot shows the Chrome console with the username field highlighted because we tried to find an element through it's XPath . In order to search for any element, just press Ctrl F on the console. A search box opens where you can type the XPath:

A similar console in Internet Explorer is called Developer Options and in Firefox it is called Firepath. In Firefox, one must remember to first add the firebug plugin from the Firefox plugins page (go to the Tools | Add-ons menu and then select Add-ons from the left pane). Only then can Firepath be accessed using the F12 key.

Apart from the consoles, which come built-in with the browsers, there are a few extensions such as XPath helper in Chrome and MRI in Internet Explorer. MRI is a bookMarklet for IE. One can get it from http://westciv.com/mri/ as a free installation. All the instructions are available on this website.

MRI will not work on popup windows. In the case of popups, the console is a better option.
主站蜘蛛池模板: 寻乌县| 迁西县| 郓城县| 台江县| 鄂托克前旗| 桦南县| 荆州市| 应城市| 汕尾市| 盐津县| 精河县| 南华县| 陆丰市| 海盐县| 中山市| 乳山市| 涟水县| 桐城市| 张家口市| 博客| 贵南县| 瑞丽市| 邓州市| 清水河县| 大余县| 清水河县| 和田市| 桂林市| 库尔勒市| 锦屏县| 栖霞市| 葵青区| 宜黄县| 银川市| 苍南县| 博客| 老河口市| 平遥县| 原阳县| 南川市| 饶阳县|