python element positioned by automated console chrome verified xpath, css

Since selenium born, a lot of plug-ins used to verify xpath / css, but if you install chrome, in fact, can not use these plug-ins

The console can be used to verify chrome xpath and css. Use chrome open the site you want to test, and then press the F12 can open a developer debugging tools

, Console where it nested in the debugging tools

Just click console, you can open a console panel

Now, you can verify your xpath or css in the console

测试css的语法是:$$(""),括号中的内容为css的定位语法,如:$$("#kw")

验证xpath也是类似的。语法是$x(“your_xpath_selector”),如:$x('//*[@id="kw"]')

注意:语法中括号里需要通过双引号括起来,如果xpath语句中有双引号,要改成单引号,不然只能解析到第一对双引号的内容。

 

When finished, press the Enter key. If your statement is correct, it will return html element corresponding to the statement

If the console mouse over this statement html, corresponding elements will be highlighted on the display screen, as shown below:

Jquery positioned elements may also be used in the console, css and similar use.

Jquery syntax: $ ( 'Here is the css selector syntax'), such as: $ ( "# kw")

Send text: .val ()

Click: .click ()

 

原文:Using chrome console to test xPath and css selectors

Guess you like

Origin blog.csdn.net/showgea/article/details/88799137