Verify that Xpath and CSS Selector are valid

XPath positioning and CSS Selector positioning are frequently used in Selenium.

 

In FireFox and Chrome browsers, you can use this method to verify that the location is accurate.

 

Take the Chrome browser as an example

Press F12 on the keyboard to enter the developer tools and switch to the console.

 

 

Methods for inspecting CSS Selectors

$("CSS SELECTOR PATH");

e.g:  $("div#password");

 

Screenshot demo:

 

 

 

 

 

Check the XPATH method

 

$x("xpath");

e.g $x("//input[@id='username']");

  

Screenshot demo:

 

Note: When validating, double quotes in XPATH and CSS SELECTOR need to be replaced with single quotes.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324890767&siteId=291194637