public class BrowserBaseState extends Object implements IBaseState
getBrowserType()
or alternatively by
getExecutable()
is running and ready for testing.
The base state additionally navigates to the URL as specified by getUrl()
and brings the
browser to the front. getLocator()
the base state navigates to the given
URL, brings the browser to the front, and returns the found test object immediately.CommonOptions.OPT_APPREADY_TIMEOUT
. For changing the timeout see
Desktop.setOption(String, Object)
.LaunchApplicationTimeoutException
is thrown.
BrowserType browserType = BrowserType.InternetExplorer;
String url = "www.borland.com";
BrowserBaseState baseState = new BrowserBaseState(browserType, url);
BrowserApplication browserApplication = baseState.execute(baseState);
Constructor and Description |
---|
BrowserBaseState()
Creates a base state with the information from the default settings file "silk4j.settings".
|
BrowserBaseState(BrowserType browserType,
String url)
Creates a BrowserBaseState that runs against a certain Browser.
|
BrowserBaseState(BrowserType browserType,
String url,
String locator)
Creates a BrowserBaseState that runs against a certain Browser.
|
BrowserBaseState(BrowserType browserType,
String url,
String locator,
TechDomain... techDomains)
Deprecated.
Deprecated since Silk Test 15.5. Use
BrowserBaseState(BrowserType, String, String) instead because Silk Test automatically detects which techdomains should be loaded.
|
BrowserBaseState(BrowserType browserType,
String url,
TechDomain... techDomains)
Deprecated.
Deprecated since Silk Test 15.5. Use
BrowserBaseState(BrowserType, String) instead because Silk Test automatically detects which techdomains should be loaded.
|
BrowserBaseState(File silk4jSettingsFile)
Creates a base state with the information from a given .settings file.
|
BrowserBaseState(String silk4jSettingsFile)
Creates a base state with the information from a given .settings file.
|
BrowserBaseState(String executable,
String url)
Creates a browser base state.
|
BrowserBaseState(String executable,
String url,
String locator)
Creates a browser base state that overwrites the default locator.
|
BrowserBaseState(String executable,
String url,
String locator,
TechDomain... techDomains)
Deprecated.
Deprecated since Silk Test 15.5. Use
BrowserBaseState(String, String, String) instead because Silk Test automatically detects which techdomains should be loaded.
|
BrowserBaseState(String executable,
String url,
TechDomain... techDomains)
Deprecated.
Deprecated since Silk Test 15.5. Use
BrowserBaseState(String, String) instead because Silk Test automatically detects which techdomains should be loaded.
|
Modifier and Type | Method and Description |
---|---|
<T extends TestObject> |
execute(Desktop desktop)
Executes the base state on the machine as specified by the desktop.
|
BrowserType |
getBrowserType()
Returns the type of browser to start if it is not already running.
|
String |
getCommandLineArguments()
Returns the additional command line arguments that will be used when starting the browser if it is not already running.
|
String |
getCommandLinePattern()
Returns the command line pattern to be used for attaching the Agent to the browser
|
String |
getConnectionString() |
String |
getExecutable()
Returns the executable that will be used when starting the browser if it is not already running.
|
String |
getExecutablePattern()
Returns the executable pattern to be used for attaching the Agent to the browser.
|
String |
getLocator()
Returns the locator the locator that specifies the test object for which the base state should wait.
|
String |
getMobileDeviceName()
Deprecated.
Deprecated as of Silk Test 17.0, use
getConnectionString() instead.
|
Set<TechDomain> |
getTechDomains()
Deprecated.
Deprecated since Silk Test 15.5. Silk Test automatically detects which techdomains should be loaded.
|
String |
getUrl()
Returns the URL to navigate to when executing the base state.
|
String |
getWorkingDirectory()
Returns the working directory that is used when starting the browser if it is not already running.
|
boolean |
isMobileBrowser()
Deprecated.
Deprecated as of Silk Test 17.5.
|
void |
setBrowserType(IBrowserType browserType) |
void |
setCommandLineArguments(String commandLineArguments)
Sets the additional command line arguments that will be used when starting the browser if it is not already running.
|
void |
setCommandLinePattern(String commandLinePattern)
Overwrites the default command line pattern to be used for attaching to the browser.
|
void |
setConnectionString(String connectionString)
Sets the name of the device to execute the base state on.
|
void |
setExecutable(String executable)
Sets the executable that will be used when starting the browser if it is not already running.
|
void |
setExecutablePattern(String executablePattern)
Overwrites the default executable pattern to be used for attaching to the browser.
|
void |
setLocator(String locator)
Sets the locator that specifies the test object for which the base state should wait
|
void |
setMobileDeviceName(String connectionString)
Deprecated.
Deprecated as of Silk Test 17.0, use
#setconnectionString() instead. |
void |
setOption(String optionName,
Object optionValue)
Sets an Agent option.
|
void |
setUrl(String url)
Sets the URL to navigate to when executing the base state.
|
void |
setWorkingDirectory(String workingDirectory)
Overwrites the default working directory for launching the application under test.
|
public BrowserBaseState()
If this test is run from Eclipse, the browser selected in the "Select Browser" dialog is applied.
If this test is run from Silk Central Connect, the browser selected in Silk Central Connect is applied.
@Deprecated public BrowserBaseState(BrowserType browserType, String url, TechDomain... techDomains)
BrowserBaseState(BrowserType, String)
instead because Silk Test automatically detects which techdomains should be loaded.
browserType
- the BrowserType to be used when executing the BrowserBaseStateurl
- the URL to navigate to. Can be null for using the default start page of the browsertechDomains
- the additional tech domains required for testing the specified web application. e.g
TechDomain.FLEX
. The tech domain TechDomain.XBROWSER
is added by default.public BrowserBaseState(BrowserType browserType, String url)
browserType
- the BrowserType to be used when executing the BrowserBaseStateurl
- the URL to navigate to. Can be null for using the default start page of the browser
@Deprecated public BrowserBaseState(BrowserType browserType, String url, String locator, TechDomain... techDomains)
BrowserBaseState(BrowserType, String, String)
instead because Silk Test automatically detects which techdomains should be loaded.
browserType
- the BrowserType to be used when executing the BrowserBaseStateurl
- the URL to navigate to. Can be null for using the default start page of the browserlocator
- specified the object to wait for when running the base state, e.g //FlexApplication
techDomains
- the additional tech domains required for testing the specified web application. e.g
TechDomain.FLEX
. The tech domain TechDomain.XBROWSER
is added by default.public BrowserBaseState(BrowserType browserType, String url, String locator)
browserType
- the BrowserType to be used when executing the BrowserBaseStateurl
- the URL to navigate to. Can be null for using the default start page of the browserlocator
- specified the object to wait for when running the base state, e.g //FlexApplication
@Deprecated public BrowserBaseState(String executable, String url, TechDomain... techDomains)
BrowserBaseState(String, String)
instead because Silk Test automatically detects which techdomains should be loaded.
executable
- e.g C:/Program Files/Internet Explorer/iexplore.exeurl
- the URL to navigate to. Can be null for using the default start page of the browsertechDomains
- the additional tech domains required for testing the specified web application. e.g
TechDomain.FLEX
. The tech domain TechDomain.XBROWSER
is added by default.public BrowserBaseState(String executable, String url)
executable
- e.g C:/Program Files/Internet Explorer/iexplore.exeurl
- the URL to navigate to. Can be null for using the default start page of the browser
@Deprecated public BrowserBaseState(String executable, String url, String locator, TechDomain... techDomains)
BrowserBaseState(String, String, String)
instead because Silk Test automatically detects which techdomains should be loaded.
/BrowserApplication
.executable
- the executable. Can contain Windows environment variables. "C:/Program Files/Internet Explorer/iexplore.exe"
"%ProgramFiles%/Internet Explorer/iexplore.exe"
url
- the URL to navigate to. Can be null for using the default start page of the browserlocator
- specified the object to wait for when running the base state, e.g //FlexApplication
techDomains
- the additional tech domains required for testing the specified web application. e.g
TechDomain.FLEX
. The tech domain TechDomain.XBROWSER
is added by default.public BrowserBaseState(String executable, String url, String locator)
/BrowserApplication
.executable
- the executable. Can contain Windows environment variables. "C:/Program Files/Internet Explorer/iexplore.exe"
"%ProgramFiles%/Internet Explorer/iexplore.exe"
url
- the URL to navigate to. Can be null for using the default start page of the browserlocator
- specified the object to wait for when running the base state, e.g //FlexApplication
public BrowserBaseState(File silk4jSettingsFile)
silk4jSettingsFile
- public BrowserBaseState(String silk4jSettingsFile)
silk4jSettingsFile
- public BrowserType getBrowserType()
BrowserType.InternetExplorer
.public String getUrl()
public void setUrl(String url)
url
- the URL to navigate to when executing the base state.
public String getCommandLineArguments()
public String getCommandLinePattern()
public String getExecutable()
null
if a BrowserType
is used to specify the browser.public void setExecutable(String executable)
executable
- the executable that will be used when starting the application if it is not already running.
public String getExecutablePattern()
public String getLocator()
public void setLocator(String locator)
locator
- the locator
@Deprecated public Set<TechDomain> getTechDomains()
public String getWorkingDirectory()
public void setBrowserType(IBrowserType browserType)
browserType
- the BrowserType to execute against. If null is specifed the BrowserBaseState is not changed.
public void setCommandLineArguments(String commandLineArguments)
commandLineArguments
- the additional command line arguments that will be used when starting the browser if it is not already running
public void setCommandLinePattern(String commandLinePattern)
commandLinePattern
- the command line pattern to be used for attaching to the browser
public void setExecutablePattern(String executablePattern)
C:/Program Files/Internet Explorer/iexplore.exe
results in
the default pattern */iexplore.exe
.executablePattern
- the executable pattern to be used for attaching to the browser
public void setWorkingDirectory(String workingDirectory)
workingDirectory
- the workingDirectory to set. Can contain Windows environment variables.
"C:/temp/test"
"%TEMP%/test"
public void setOption(String optionName, Object optionValue)
baseState.setOption(CommonOptions.OPT_WAIT_RESOLVE_OBJDEF, true)
optionName
- The name of the option. For a list of available options see CommonOptions
.optionValue
- The value of the option.
public <T extends TestObject> T execute(Desktop desktop)
IBaseState
execute
in interface IBaseState
desktop
- The desktop@Deprecated public String getMobileDeviceName()
getConnectionString()
instead.
null
if the base state should not be executed on a mobile device.null
public String getConnectionString()
@Deprecated public boolean isMobileBrowser()
true
if the browser specified by this base state is a mobile browser and returns false
if it is a desktop browser.true
if the browser specified by this base state is a mobile browser and false
if it is a desktop browserpublic void setConnectionString(String connectionString)
connectionString
- the mobile device name, the wildcards * and ? can be used. Example: 'Nexus 10'
@Deprecated public void setMobileDeviceName(String connectionString)
#setconnectionString()
instead.connectionString
- Copyright 2009-2012 Micro Focus. All Rights Reserved.