Associate Browser
Attaches a browser instance to a new or an existing web automation scope.
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary scripting language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
webAttach --browser(Browser) --name(String)
Dependencies
Use the Start Browser (webStart
) command to start a browser or use the Find Internet Explorer Browser (findBrowser
)
command to attach the Microsoft Internet Explorer before using the Associate Browser (webAttach
) command.
Input parameter
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Browser | browser |
Required |
Browser |
Browser to attach to the web automation scope. Obtain the Browser instance using the Start Browser or Find Internet Explorer Browser commands. |
Name | name |
Required |
Text |
Browser instance name. You may use the same name from the instance created by the Start Browser command. |
Example
The Start Browser command starts the Goole Chrome and the Mozila Firefox browsers. Each browser refers to one browser instance. The web automation scope is in the last browser started (Mozilla Firefox). So, the Associate Browser attaches the Google Chrome browser instance to the current web automation scope again to use it to continue navigating.
defVar --name chrome --type Browser
defVar --name firefox --type Browser
webStart --name browserChrome --type "Chrome" chrome=value
// Navigate to google.com web page using the Google Chrome browser instance.
webNavigate --url "google.com"
webStart --name browserFirefox --type "Firefox" firefox=value
// Navigate to google.com web page using the Mozila Firefox browser instance.
webNavigate --url "google.com"
webWait
webAttach --browser ${chrome} --name browserChrome
// Navigate to ibm.com web page using the Google Chrome browser instance.
webNavigate --url "https://www.ibm.com"
webClose --name browserChrome --leavebrowseropen
webClose --name browserFirefox