Home > Language Reference > Web Functions > StartBrowser

StartBrowser

The StartBrowser function starts the speficied Internet browser and loads the specified url. Internet Explorer 32-bit version 8 or above, Firefox and Chrome browsers are the supported Internet browsers.

Usage

Used to start a web automation script, specifying which browser is used and which first url is loaded.

Syntax

ret=StartBrowser(<browser_type> [, <url_address> [, 1|2|3]])

Parameters

<browser_type>, string, constant. The three possible values are "IE" for Internet Explorer, "FF" for Firefox and "CH" for Chrome (all subsequent Web functions are executed in the specified browser).

<url_address>, string, optional, url to load. If this parameter is not specified, the browser default start page is loaded.

1|2|3, integer, constant, optional. Indicates whether browser window is minimized (value 2), maximized (3), or normal (1). Default is 1 for normal browser window size.

Return value

Ret, optional numeric return code. If the function succeeds to load the initial page within the timeout period  (30 seconds by default or the #ActionTimeout value), the function returns 0. If the function fails, the return code is a nonzero negative value (see Web Functions Error Codes).

Remarks

StartBrowser ("IE") launches the default 32-bit IE version. The 64-bit version of IE is not supported.

Avoid to launch StartBrowser loading a blank page as Internet Explorer takes a blank page as suspicious.

If you use Chrome on a "slow" PC, do not open the browser maximized, so the last parameter must not be at 3.

StartBrowser statement fails if a web window prompts for data (a Security Alert web window, a Certificate web window, a Login web window). See article Handling Page Timeout Error and the example below.

Examples

'Lauch the url www.wintask.com using Internet Explorer, the IE  window is maximimized
StartBrowser("IE","www.wintask.com",3)

'Launch the url www.wintask.com using Firefox, the FF window is maximized
StartBrowser("FF","www.wintask.com",3)

'Launch the url www.wintask.com using Chrome, the last parameter must not be specified
StartBrowser("CH","www.wintask.com")


'If a web window (such as a password prompt) prevents the initial page to load, launch the browser using Shell (launch Iexplore.exe under Program files (x86))
'For example:
Shell(Chr$(34)+"C:\Program Files (x86)\Internet Explorer\iexplore.exe"+Chr$(34)+" www.wintask.com",3)