Browser
Use the Browser step type to manage browser instances during test execution.
Note: Beginning with release 8.55, PTF supports running multiple browser instances from a single PTF client. This enables you to toggle between any or all open browsers. For example, you could use this functionality to verify that an action from one browser instance would change the data displayed in another browser instance.
To identify and manage each instance, you can assign a name, using a string or a variable, when it is launched. If you do not specify a name parameter, then PTF will assign “browser_0” as a name for the first browser, then “browser_1” for the second brower, and so on. If the 2nd browser is opened due to using a specific FormFactor, then PTF uses the name “FormFactor”, similarily if it is opened due to a query, the name assigned is “query”.
PTF also assigns each instance an index value automatically, and you can use the index to refer to a specific instance. The first browser instantiated is assigned an index value of 0. The next browser instantiated will have an index value of 1, and so on. If a given browser is closed, then the index value for any browsers that were instantiated after that brower will decrease by 1, in other words the index is dynamically updated by PTF.
These are the actions associated with the Browser step type.
Description
Closes the current browser window (that is, the one with the execution focus).
Description
Closes all browser instances that were instantiated by the PTF client.
Note: Only browser instances that were instantiated by the same PTF client execution instance are closed.
Description
Determines the number of currently open PTF client-initiated browser instances.
Note: Counts only browser instances that were instantiated by the same PTF client execution instance.
Parameters
Field or Control |
Definition |
---|---|
ret=&variable |
Specify a variable to store the return value. |
Description
Checks if a browser instance exists. Evaluates to true if it exists, false if it does not.
Parameters
Field or Control |
Definition |
---|---|
name=value |
The name of the browser instance, such as browser1. |
ret=&variable |
Optional parameter. Specify a variable to store the return value. |
Description
Checks if a frame exists on a browser page. Specify the frame name in the value column.
Parameters
Field or Control |
Definition |
---|---|
expected=value |
Optional parameter. If used, PTF writes either a Pass or Fail for the step in the test log, based on whether the matching frame exists. If this parameter is not included, then only step information is logged during execution. For example:
|
ret=&variable |
Optional parameter. Specify a variable to store the return value. |
Description
Sets the focus in a browser frame.
Embedded frames include a number, such as ptModFrame_1. You can substitute ## for the number, for example ptModFrame_## and PTF will search through all frames starting with ptModFrame_ and use the one with the highest number.
Description
Gets the currently active browser instance’s name or index. Use in combination with Set_Active when working with multiple browser instances, to control which one is active.
Parameters
Field or Control |
Definition |
---|---|
name=<value> | |
index=<value> | |
ret=&variable |
Optional parameter. Specify a variable to store the return value. |
Example
The following example shows a PTF test step that uses the Browser.Get_Active type/action.
Type |
Action |
Recognition |
Parameters |
Value |
---|---|---|---|---|
Browser |
Get_Active |
|
ret=&hook1 |
|
Description
Sets the active browser instance, when working with multiple browser instances. Use in combination with Get_Active to control which browser instance is active when working with multiple browsers instances.
Example
The following example shows a PTF test step that uses the Browser.Set_Active type/action.
Type |
Action |
Recognition |
Parameters |
Value |
---|---|---|---|---|
Browser |
Set_Active |
&hook1 |
|
|
Description
Sets the portal type. Uses the URL for the selected portal type defined in the execution option to access the component. This is the URL that is used with Page.Prompt.
Example
The following example shows a PTF test step that uses the Browser.Set_URL type/action.
Type |
Action |
Recognition |
Parameters |
Value |
---|---|---|---|---|
Browser |
Set_URL |
EMPLOYEE |
|
|
Description
Starts the browser instance where the test will be executed. Uses the URL from the currently active execution option.
Description
Starts the browser instance where the test will be executed and logs into the PeopleSoft application. Uses the URL, user ID, password, and form factor from the currently active execution option, and the language selected in the test Language field.
Parameters
Field or Control |
Definition |
---|---|
name=value |
Optional parameter. Assigns a name to the browser instance. This enables you to manage multiple browser instances by referring to them by their assigned name. You can use a string or a variable to specify the name. |
Description
Waits for a new browser instance to open, then continues test execution in that browser instance.
Specify a timeout value in seconds in the Value column. The default is 10 seconds.
Note: Microsoft Internet Explorer must be set to open pop-ups in a new window for PTF to recognize new browser windows. To set this option, in Internet Explorer select Tools, Internet Options. Click the Tabs button, then select Always open pop-ups in a new window, then click OK.
Parameters
Field or Control |
Definition |
---|---|
name=value |
Optional parameter. Assigns a name to the new browser instance. This enables you to manage multiple browser instances by referring to them by their assigned name. You can use a string or a variable to specify the name. |
max=value |
True – maximizes the window for the new browser instance. False – keeps the existing window size for the new browser instance. The default is true. |
Example
The following example shows a PTF test step that uses the Browser.WaitForNew type/action. This step launches a new test application browser instance with the window maximized, assigns the name “browser1” to the browser instance, and waits 30 seconds before proceeding to the next test step. Test execution then continues in the new browser instance.
Type |
Action |
Recognition |
Parameters |
Value |
---|---|---|---|---|
Browser |
WaitForNew |
|
name=”browser1”;max=true |
30 |