Description
Use this property to pass additional command-line parameters to the browser.
This property is not applicable to browsers running on remote computers.
Declaration
BrowserInfoObj.RunOptions
Write-Only Property | String |
BrowserInfoObj | An expression, variable or parameter that specifies a reference to a BrowserInfo object |
Applies To
The property is applied to the following object:
Property Value
A string with command-line parameters to be applied upon the next launch of the browser.
Remarks
-
The specified run options are applied upon the next launch of the browser via the
Run()
method. They cannot be applied to an already running instance of the browser. -
The values assigned to the run options are persistent throughout the current test, they are not preserved from one test run to another.
-
To get the complete command line used to launch the browser (including the fully-qualified browser path and the command line arguments), use the
CommandLine
property of the correspondingBrowser
process. -
In projects that use Python as a scripting language, calling the
RunOptions
property from keyword tests, for instance, as part of a code snippet the operation runs, may fail. To avoid possible issues, use the__setprop__
method. For example:Python
Browsers.Item[btChrome].__setprop__('RunOptions', '--allow-file-access-from-files')
Example
The code below demonstrates how to use the RunOptions
property to start Google Chrome with the --allow-file-access-from-files command-line key. This key should be specified when testing local pages containing HTML frames.
JavaScript, JScript
function SetChromeRunOptions()
{
// Specify the required command-line key
Browsers.Item("chrome").RunOptions = "--allow-file-access-from-files";
Browsers.Item("chrome").Run();
// Perform the test
...
}
Python
def SetChromeRunOptions():
# Specify the required command-line key
Browsers.Item["chrome"].RunOptions = "--allow-file-access-from-files";
Browsers.Item["chrome"].Run();
# Perform the test
# ...
VBScript
Sub SetChromeRunOptions
' Specify the required command-line key
Browsers.Item("chrome").RunOptions = "--allow-file-access-from-files"
Browsers.Item("chrome").Run
' Perform the test
...
End Sub
DelphiScript
procedure SetChromeRunOptions;
begin
// Specify the required command-line key
Browsers.Item('chrome').RunOptions := '--allow-file-access-from-files';
Browsers.Item('chrome').Run;
// Perform the test
...
end;
C++Script, C#Script
function SetChromeRunOptions()
{
// Specify the required command-line key
Browsers["Item"]("chrome")["RunOptions"] = "--allow-file-access-from-files";
Browsers["Item"]("chrome")["Run"]();
// Perform the test
...
}