Inspector - AI-Powered Element Inspector
Learn how to use the Inspector feature to generate accurate locators for web elements.
The Inspector feature in Testio.AI allows you to inspect web elements and generate accurate locators for popular test frameworks and programming languages. With a seamless interface and AI-powered suggestions, it helps testers simplify element identification and improve test reliability.
How to Use the Inspector
Step 1: Open Testio.AI
- Launch the Testio.AI Chrome extension by clicking its icon in the browser toolbar.
- Create a new workspace or open an existing workspace.
- Navigate to the Inspector feature.
You will see:
- A dropdown to select your Test Framework (e.g., Selenium, Cypress, Playwright).
- A dropdown to select your Programming Language (e.g., Java, TypeScript, Python, C#).
Step 2: Start Element Inspection
- Click on the Element Inspector button (sparkle icon ✨).
- A highlight cursor will appear.
- Select any web element on the page that you wish to inspect.
Step 3: View DOM Structure
Once an element is selected, the Inspector displays:
- Detailed DOM Structure – Including
tagName
,id
,className
, attributes, and context for AI. - Parent Context – View the hierarchical structure of parent elements for better clarity.
- Previous Siblings Context – View the hierarchical structure of previous sibling elements for better clarity.
- Next Siblings Context – View the hierarchical structure of next sibling elements for better clarity.
Example DOM Structure:
Step 4: AI Analysis for Locators
Once the DOM Structure is displayed, AI Analysis section provides accurate and robust locators for the selected element. The generated locators are tailored to the chosen test framework and programming language.
AI-Generated Locators Examples
The locators are presented in multiple strategies to ensure flexibility and reliability:
- By Test ID: Targets elements using custom data attributes.
- By Label: Uses the visible label of the element.
- By Role with Name: Targets elements using their accessibility roles and name attributes.
- By ID: Selects elements with unique IDs.
- By Attributes (e.g., aria-describedby): Utilizes accessibility attributes for more robust targeting.
- By XPath: Utilizes XPath axes, functions, and attributes for more robust targeting.
- By CSS Selectors: Utilizes CSS selectors and attributes for more robust targeting.
Playwright with TypeScript
Selenium with Java
Playwright with Python
Selenium with C#
Cypress with TypeScript
Puppeteer with TypeScript
Step 5: Save Elements
The Save Elements feature allows testers to store inspected elements and their generated locators for future reference. This helps manage locators efficiently and reuse them across multiple test scripts.
- After inspecting an element and generating locators, click on the Save Element button.
- The element is stored in the Saved Elements section with the following details:
- Tag Name: The HTML tag of the element (e.g.,
input
,button
). - Framework: The selected test framework (e.g., Selenium, Playwright).
- Language: The chosen programming language (e.g., Java, TypeScript).
- Timestamp: Time when the element was saved.
- Tag Name: The HTML tag of the element (e.g.,
Features of Saved Elements
- View Saved Elements
- Saved elements are displayed in a list format under the Saved Elements section.
-
Tag and Search
- Each saved element will be tagged for better organization.
- Use the search bar to quickly find specific saved elements by tag name.
-
Filter Elements
- Use the dropdown to filter and sort saved elements, e.g., Latest or Oldest.
-
Delete Unused Elements
- Remove obsolete elements using the Delete button.
Use Case
Simplifying Web Element Inspection
The Inspector feature in Testio.AI streamlines the process of identifying, analyzing, and generating locators for web elements, making it an essential tool for web testers.
Scenario: Validating a Login Form
Objective: Automate test scripts for a login form containing Username
, Password
, and a Submit
button.
Steps:
- Inspect Elements: Use the Element Inspector to inspect the
Username
,Password
, andSubmit
button fields. - Generate Locators: Generate locators for each field using AI Analysis in frameworks like Playwright, Selenium, or Cypress.
- Save Locators: Use the Save Elements feature to store and tag locators for future reuse.
Example Locators for Playwright (TypeScript):
Benefits
The Inspector feature in Testio.AI offers significant advantages to web testers:
AI-Powered Locators
- Automatically generate robust and reliable locators for any web element.
- Supports multiple locator strategies (e.g., ID, class, test attributes, and roles).
Multi-Framework and Language Support
- Generate locators for popular frameworks like Selenium, Playwright, Cypress, and WebDriverIO.
- Supports languages such as Java, Python, TypeScript, and C#.
Improved Productivity
- Eliminate manual inspection of elements and reduce time spent debugging unreliable locators.
- Save and organize locators for future reuse, minimizing repetitive tasks.
Enhanced Test Reliability
- Use attributes, labels, and roles to create resilient locators that adapt to UI changes.
- Avoid fragile selectors by leveraging AI recommendations.
User-Friendly Interface
- Easy-to-use UI for inspecting elements, generating locators, and saving results.
- Seamless navigation for managing saved locators with tags and filters.
Conclusion
The Inspector feature empowers testers to inspect, generate, and organize web element locators with ease. By combining AI-powered precision with a user-friendly interface, Testio.AI helps you:
- Streamline element identification.
- Automate test script generation.
- Save time and boost testing productivity.
Start using the Inspector today to simplify your testing workflows and ensure robust, reliable test automation! 🚀