In automation testing based on UI elements, whether it is UI automation testing for desktop or UI automation testing for web. First of all, we need to find and identify UI elements.
In automated testing based on Web UI, testers need to understand some knowledge of HTML, CSS and Javascript, and also learn to use various browser debugging functions
To find elements on a Web UI page, you must first understand the DOM structure of the page, the attributes of the element, and even some JavaScript call information. Now mainstream browsers come with many powerful tools.
Reading Contents
Google Chrome
Google Chrome comes with web development and debugging tools, and you can start this tool in 3 ways.
Method 1: Press the F12 shortcut key
Method 2: Click the icon in the upper right corner ->More tools->Developer Tools menu command, open the Developer Tools, then click the "arrow" icon, and select the element you want to find. Please see the animation demonstration below
Method 3: Place the mouse on the UI element you want, right-click, and select the Inspect Element menu command
We can also use Chrome to directly get the XPath of the element.
Internet Explorer or Edge
The browser produced by Microsoft also comes with "developer tools" and is launched through the tool menu or F12.
Firefox's firebug plugin
Firefox is the best browser supported by selenium. It is recommended to install the Firebug plug-in in Firefox. It is also very convenient to find page elements using firebug.
The calling method of firebug is exactly the same as the usage method of Chrome's debugging tool above. I won't explain in detail here
Use the FireFinder plugin to test XPath statements
In automated testing, we often have to write XPath. We can use the FireFinder plug-in to verify whether the xpath statement we write is correct.
The above is the information on Java selenium using browser debugging tools to organize and continue to add relevant information. Thank you for your support for this site!