Block reference / Web interaction
Link
Open the address of a link on the page, in the same tab or a new one.
Only in
WarpX Browser
Link reads the address of an <a> element and goes there, instead of clicking it. Reach for it when a click would be caught by an overlay or open a popup, or when you want the linked page in a new tab of the profile's browser while the current page stays open.
Settings
- Element Selector
The link to open. It must be an
<a>element; the block uses the first match. Write a CSS selector or an XPath: a value that starts with/,(,@orid(is read as XPath. The target button lets you click the element in the profile's browser, inside iframes and shadow roots too, and the double tick checks that the selector finds something.Examplea.product-card__title- Mark elementwhen the selector is CSS, not XPath
Tags each element the block acts on, and skips tagged elements the next time this block runs, so a loop moves on to the next match. Only offered for a CSS selector.
ExampleUnchecked- Wait for selector
Keeps looking for the element until it appears or the timeout runs out. Off, the block looks once.
ExampleChecked- Selector timeout (ms)when Wait for selector is on
How long to keep looking, in milliseconds. The default is
5000.Example10000- Open in new tab
Opens the address in a new tab of the profile's browser, and every block after this one runs in that tab. Off, the current tab goes to the address.
ExampleChecked
Every block also has the shared block settings — a description, Disable block and what to do on an error, and Finding elements explains selectors in more depth. Fields that take text accept data from earlier blocks.
What it hands on
Writes nothing to the table or variables. Leaves by its single output with the link's address as its result, which the next block can read as {{prevBlockData}}. If nothing matches the block fails with element-not-found, and if the match is not an <a> element it fails with "Element is not a link".
Example: Open the first search result in a new tab and read its title
- Start
- Open URL
- Link
- Get text
- Add Open URL after Start with
https://shop.example.com/search?q=headphones. - Add Link. Click the target button next to Element Selector and click the first product title in the profile's browser, or type
a.product-card__title. - Tick Wait for selector and set Selector timeout (ms) to
10000, so the block waits for the results to load. - Tick Open in new tab.
- Add Get text after it with
h1.product-titleand Wait for selector ticked. It runs in the new tab. - Run the workflow. The product page opens in a second tab and its title is read from there.
Good to know
- Only
<a>elements work. For a button or anything else that navigates with script, use Click element. - Without Open in new tab, the block does not wait for the new page to load. Tick Wait for selector on the block after it.
- With Open in new tab, the old tab stays open. A frame chosen with Switch frame is dropped, because the new page has none of the old page's frames. Use Switch tab to go back to the first tab.
- There is no Multiple option. The block always opens the first match.
See also
- Click element — Click an element on the page, with human-like mouse movement by default.
- Switch tab — Move the run to another open tab, found by its address, its title or its position.
- Open URL — Load a web address in the current tab or a new one, and wait for it to load.
- New tab — Opens an address in a new tab of the profile's browser and moves the workflow onto it.