Aqua 2024.3 Help

Work with Web Inspector

This section covers the basic scenarios of working with the Web Inspector functionality and provides information on how to utilize it in different contexts.

Obtain locators

Open a website

Before selecting elements on the webpage, you need to access it first. To do this, perform one of the following:

  • Specify the URL in the address bar and press Enter.

  • If your code has a comment that contains the URL of the website being tested, click the icon in the gutter.

    Open Web Inspector from gutter
  • If the website is mentioned somewhere in your code, place the caret at the URL, press Alt+Enter, and select the Open in Web Inspector option.

    Open in Web Inspector

This opens the webpage in the Web Inspector.

Select a web element

To select an element on the webpage, do one of the following:

  • Click the button located in the Locators Evaluator section and select the element.

    Select element in page
  • Start typing the locator or its substring in the search field of the Locators Evaluator section. The auto-completion feature suggests a list of elements to choose from.

    Type the locator in the search field
  • Select the element in the Page structure section. This method is usually used to navigate to the element located above/below the one that was selected initially.

    Select element from Page structure

Once you select an element, Aqua generates a unique locator for it. This ensures that each locator points to a specific element on the page.

Add locators to code

To add the generated locator to your code, do one of the following:

  • Copy the locator to clipboard by clicking the Copy Locator button. After that, you can manually add the copied locator to your code.

  • Click the button in the Locators Evaluator section. Prior to this, you can select the type of the locator (CSS or XPath) by clicking the Locator type button.

  • If you want to add an element to your code using a specific selector (ID, Name, Tag with classes, and so on), click the Add Element to Code By button and select the desired one from the list.

    Add elements to code by

Adding the locator to code using the or Add Element to Code By buttons generates a framework and language-specific expression that captures the selected element and adds it to your code. If the system defined the framework incorrectly, you can manually change it.

Work with frames

Aqua supports selecting elements located in frames and helps you to generate frame-switching code for your tests. When you select an element that is not in the root frame, you are automatically switched to the frame that contains the selected element. The Page structure also gets updated to represent the contents of the frame and provide navigation within it.

Switch between frames

  • When you select an element in a different frame, a breadcrumb representing the frame you switched to appears. To switch back to the root frame, double-click the top frame button.

    Switch back to the root frame
  • To switch to one of the existing frames, click the top frame button and select the frame from the list.

    Switch to a different frame

Generate frame-switching code

  • Right-click the top frame button and click Generate Frame Elements From Selected.

    Generate root switching code

    The generated code corresponds to the supported language and framework.

Generate UI tests and page models

Integration with the AI Assistant plugin allows you to generate sample UI tests and page models for the web pages opened in Web Inspector. The code is generated for the selected framework and programming language, and contains significant elements from the page.

To use this feature:

  1. In Web Inspector, open the web page for which you want to generate UI tests or create a page model.

  2. Click the icon located in the Locators Evaluator section.

    Generate UI tests and Page Models
  3. Depending on what you want to generate, select the framework and programming language under the respective section.

    Select the framework and language

    This opens a chat with the AI Assistant, where a response to your request is provided.

  4. In the AI Assistant tool window, do either of the following:

    Add generated code
    • Click to copy the generated code to the clipboard. The code can then be manually pasted where applicable.

    • Click to insert the generated code to the current file at the caret's position.

    • Click to create a new file from the generated code.

Validate locators

To verify that the locator is valid and points to the correct element on the web page, do one of the following:

  • In the code editor, click the icon next to the locator that you want to validate.

    Verify locator

    If the locator is valid, the Web Inspector tool window opens, and the corresponding element gets highlighted in the Web Inspector and Page structure section.

  • Copy your locator and paste it to the search field in the Locators Evaluator section. If there are no matches, the locator is invalid.

If you want to check to which element on the webpage the selected locator is related, do either of the following:

  • In the code editor, click near the locator.

    Verify locator
  • Place the caret at the locator and press Alt+Enter. Then, select the Evaluate in Web Inspector option to navigate to the web element.

    Evaluate in Web Inspector
  • Click the locator while holding the Ctrl key.

As a result, the Web Inspector tool window opens, and the corresponding element gets highlighted.

Clear URL history

To clear the Web Inspector browsing history, do the following:

  1. Press Shift twice to open the search window.

  2. Switch the search scope to Actions by pressing Tab.

  3. Type Clear Url History and select the corresponding action from the list.

    Clear URL History
Last modified: 04 December 2024