Browser event
Waits until a page loads, a tab or window opens, or a tab or window closes in the profile's browser.
Only in
WarpX Browser
Browser event pauses the workflow until something happens in the profile's browser: a page finishes loading, a new tab opens, a tab closes, or the browser itself closes. Reach for it when the next step depends on the browser rather than on one element, such as a report that opens in its own tab after a few seconds. While the block waits, WarpX Browser checks the profile's tabs about every 0.7 seconds, so an event is noticed within a second or so. To wait for a particular element, Element exists is more precise.
Settings
- Timeout (milliseconds)
How long the block waits. With Tab loaded, running out of time fails the block with
timeout. With the other events, the block carries on when the time is up, as if the event had happened.Example30000- Events
The event to wait for: Tab closed, Tab loaded or Tab created under Tab, and Window created or Window closed under Window. WarpX Browser treats a profile's browser as one window, so Window created fires when a new tab opens, and Window closed fires when the browser has no pages left, which is when it closes.
ExampleTab created- Match patternwhen Events is Tab loaded and Active tab is off
Match patterns for the tabs to wait on, separated by commas.
<all_urls>matches any page, and an empty field waits on every tab of the profile. The block passes once every open tab that matches has finished loading, and at once if none matches.Examplehttps://shop.example.com/*- Active tabwhen Events is Tab loaded
Wait for the tab the workflow is working in to finish loading, instead of the tabs a match pattern names. It fails with
no-tabif the workflow has no tab yet.ExampleChecked- Filterwhen Events is Tab created or Window created
Only a new tab whose address matches counts. Write part of the address or a regular expression. Leave it empty to accept any new tab.
Example/reports/view- Set as active tabwhen Events is Tab created or Window created
Later blocks work in the new tab, with Tab created or Window created. The tab is also brought to the front, if something else covers it. If no tab opens before the timeout, the workflow stays on the tab it was in.
ExampleChecked
Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.
What it hands on
Leaves by its only output. It writes nothing to the table or to variables. Tab loaded fails with timeout when the pages it waits on have not loaded in time. The other events never fail: when the timeout runs out, the block carries on without the event.
Example: Read a report that opens in a new tab
- Open URL
- Click element
- Browser event
- Get text
- Add Open URL with
https://shop.example.com/account/reports. - Add Click element on
button.export. The site prepares the report and opens it in a new tab a few seconds later. - Add Browser event, choose Tab created, set Filter to
/reports/viewand Timeout (milliseconds) to30000. - Tick Set as active tab, so the workflow moves onto the new tab.
- Add Get text on
.report-totalwith Insert to table on.
Good to know
- Tab created and Window created only count tabs that open while the block is waiting. A tab that was already open when the block started, for example one a click opened straight away, is not announced. To move to such a tab, use Switch tab, which looks among the open tabs.
- A new tab is announced once it has an address other than
about:blank, or after about 3 seconds. A tab that is still blank by then is announced asabout:blankand does not pass a Filter. - Tab closed fires for any tab of the profile, not only the one the workflow uses. It also fires when the profile's browser closes.
- Tab loaded reads each page's own load state. Right after a click, the next page may not have started loading yet, and the old page then counts as loaded. To wait for a particular page, use Element exists on one of its elements.
- With Set as active tab on, the workflow starts at the top of the new tab's page. A frame chosen earlier with Switch frame is forgotten, as with Switch tab.
- Open URL, New tab, Go back, Go forward and Reload tab already wait for their page to load before the next block runs.
See also
- Switch tab — Move the run to another open tab, found by its address, its title or its position.
- Element exists — Check whether an element is on the page and continue by one of two outputs.
- Close tab/window — Closes the tab the workflow is using, the tabs that match a pattern, or every window.
- Open URL — Load a web address in the current tab or a new one, and wait for it to load.