Browser go to (FR)

Perfecto Command

mobile:browser:goto

Purpose

Opens the browser application and browses to the specified location. This is done with a direct native command to the device OS, and not with navigation.

No validation is performed. The green success status confirmation within the execution report does not validate that the browser was opened; rather, it validates that the native command request was successfully received by the device OS.

The URL page will not refresh if the browser go to function is used with the same URL consecutively. To ensure that the URL page is reloaded, use the Browser open function followed by the Browser go to function.

Parameters

Name

Value

Default

Description

deviceID*

   

The device for this command.

url*

   

The specified URL.

waitForPageLoad

 

false

Selects whether command should execute synchronously - waiting for the page to load before returning control. Default is to work asynchronously, and return immediately after registering the request.

automation

simulated (Default)

os (OS)

chrome ()

safari ()

native ()

default

The automation mode for web applications, where:

  • Default: Opens the URL in the device's default (native) browser and in a new tab. Existing tabs remain open.

  • OS: Uses a DOM-object-supported browser (Safari on iOS, Chrome on Android). When selected, the system ensures only one tab is open. If tabs are already open, the system closes them before opening the URL

* Mandatory

Return Value

"OK" if successful, "Failed" otherwise

Exceptions

None

Examples

Copy

Java sample

//declare the Map for script parameters
Map<String, Object> params2 = new HashMap<>();
params2.put("url", "https://www.phys.org");
String res2 = (String) driver.executeScript("mobile:browser:goto", params2);
Copy

C# sample

//declare the Map for script parameters
Dictionary<String, Object> pars = new Dictionary<String, Object>();

pars.Add("url", "https://www.phys.org");
String res = (String) driver.ExecuteScript("mobile:browser:go", pars);