In an automated test based on UI elements, whether it is a desktop UI Automation test or a Web UI Automation test. First we need to find and identify UI elements.
In web-based UI automation testing, testers need to understand some of the knowledge of HTML, CSS, and JavaScript, and also need to learn to use the debugging capabilities of various browsers
To find elements on a Web UI page, you must first understand the DOM structure of the page, the attributes of the elements, and even the invocation information of some JavaScript. Now the mainstream browsers are bringing a lot of powerful tools
Reading Table of Contents
- Google Chrome
- Internet Explorer or Edge
- Firefox's Firebug Plugin
- Use the Firefinder plug-in to test XPath statements
Google Chrome
Google Chrome has its own web development debugging tool, which enables you to launch this tool in 3 ways
Method One: Press F12 shortcut key
Method Two: Click on the top right corner of the icon->more tools->developer Tools menu command, open Developer Tools, and then click the "Arrow" icon, and then select the element you want to find. Take a look at the following animated demo
Method Three: Mouse over the UI element you want, click the right mouse button, select the Inspect Element menu command
We can also use Chrome to get the XPath of the element directly.
Internet Explorer or Edge
Microsoft's own browser also comes with "developer tools," Using the Tools menu or F12 to launch
Firefox's Firebug Plugin
Firefox is the best browser supported by selenium and recommends installing Firebug Plug-ins in Firefox. It's also easy to find page elements with Firebug
The Firebug method of invocation is exactly the same as the Chrome debugging tool above. This is not a detailed explanation.
Use the Firefinder plug-in to test XPath statements
In automated testing, we often write XPath, and we can use the Firefinder plug-in to verify that the XPath statement we wrote is correct
The above is the Java Selenium use browser debugging tool data collation follow-up to continue to supplement the relevant information, thank you for your support of this site!