Skip to main content

Launch-a-New-Browser

Command Description

Start a new browser so that RPA Creator can operate on it. The browser can be Internet Explorer, Chrome, FireFox, 360, Edge, or Laiye RPA (can only open one browser window). The bound browser handle string is returned when the command run successfully. Null is returned when failed

Command Prototype

hWeb = WebBrowser.Create(sType,sURL,iTimeOut,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
sTypeTrueenum"ie"Type of browser
sURLTruestring"about:blank"The URL when the browser is launched
iTimeOutTruenumber30000Specify the amount of time (in milliseconds) that wait for the event to run before selectorNotFoundException to trigger an error (in milliseconds) The default value is 30,000 ms (30 seconds)
bContinueOnErrorNonebooleanNoneSpecify whether the automation should continue to support this field even if the activity is incorrect, it is only supported by the Boolean value (true, false) default value
iDelayAfterNonenumber300Delay time (in milliseconds) after executing the activity is 300 milliseconds
iDelayBeforeNonenumber200The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds
sBrowserPathNonepath""Browser path, default is an empty string. When the value is an empty string, it automatically looks for the browser installed on the machine and tries to start it
sStartArgsNonestring""Browser's launch parameters

return

hWeb,The variable used to save the output of the command.

Demo

/************************************Start a new browser*********** **************************** 
Command prototype:
WebBrowser.Create(sType,sURL,iTimeOut,optionArgs)
Input parameters:
sType--Browser type: IE, Chrome, FireFox, Edge, 360Browser, Laiye RPA browser
sURL--Open the link to jump to the browser
iTimeOut--abnormal waiting time
bContinueOnError--whether to continue after error
iDelayAfter-- delay after execution
iDelayBefore--delay before execution
sBrowserPath--Browser installation path
sStartArgs--Browser startup parameters

Outgoing reference:
hWeb--Browser handle string
*********************************************************************/
//Start a new browser, so that Laiye RPA can operate on this browser, the browser to start can be Internet Explorer, Chrome, FireFox, 360, Edge, Laiye RPA browser (Laiye The RPA browser only supports launching a browser window), the command will return the bound browser handle string if the command runs successfully, and null if it fails.
Dim hWeb
hWeb = WebBrowser.Create("ie","www.baidu.com",30000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"sBrowserPath":"","sStartArgs":""})
TracePrint(hWeb)