Get the number of tabs Version 1 (Java)

Action group: Browsers


Description

The action returns the number of tabs in the browser.

Action icon

image-2024-12-24_11-53-20.png

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ContextAction context for browser operations.Robin.SeleniumBrowser contextYes
Results
ResultThe number of tabs in the browser.Robin.Numeric

Special conditions of use

The action will not fail if there are no open tabs in the browser other than the browser home page.

Tab groups will be counted by the number of tabs inside. A group does not count as one tab.

If you put tabs in a group and ask the group to open in a new window, the tabs in the new window will still be counted because the context remains shared. And if you try to close the context (browser), all windows generated from it will be closed. 

Example of use

Task 

Open two tabs in a browser, switch to the first one and refresh it.

Solution 

Use the "Open Browser", "Navigate", "Switch to Tab", "Refresh" actions.

Implementation

  1. Assemble a robot scheme with the actions.
  2. Set the "Open browser" action parameter.
  3. Set the "Navigate" action parameters (the first link).
     
  4. Set the "Navigate" action parameters (the second link).
     
  5. Set the "Switch to Tab" action parameters.
  6. Set the "Refresh" action parameter.
  7. Click "Start" in the top panel.

Result

The program robot completed successfully.

  • Нет меток