1. Home
  2. OpKey Help
  3. 16. Keywords in OpKey Test Accelerator
  4. 16.4 Selenium JS Keywords

16.4 Selenium JS Keywords

AccessibilityCheckPointsSettings

Accessibility Testing is a subset of Usability Testing and it is performed to ensure that the application being tested is usable by people with disabilities like hearing, color blindness, old age and other disadvantaged groups.

This keyword sets the prerequisites for Accessibility Test. It takes the report name of the Accessibility Test and the location where the Accessibility Report of a page after creation will be stored.

It will check the Accessibility of the current page and will generate the Accessibility Report of that particular page at the location or path given by the user.

Input Arguments

Object Input Arguments

Required?

Description

Object

No

This keyword does not require any Object input argument.

 

Data Input Arguments

Required?

Description

Report

Name

Yes

* It is of String type.

* It takes the name of the report to be created.

Report FolderPath  

Yes

* It is of String type.

* It takes the path(location) where Accessibility Report will be saved after creation.

Output

 

True

If the keyword passes successfully

False

If the Keyword Fails

Example

Suppose you want to sets the prerequisites for Accessibility Test then, here is how you will use AccessibilityCheckPointsSettings keyword.

AccessibilityCheckPointsSettings

Report Name

ABC

Report Folder Path

Common Error conditions

Scenarios

Error Message

Debug Information

If Data Input Argument is not given

Argument Data Missing

Argumnent(s): (ReprtName; ReportFolderPath) is/are blank.

SetViewPort

This keyword sets the Page Layout according to the given dimensions. It is basically used to open any website/browser in the Mobile View.

Input Arguments

Object Input Arguments

Required?

Description

Object

No

This keyword doesn’t take any object input argument.

 

Data Input Arguments

Required?

Description

Width

Yes

* It is of Integer type.

* It takes the width of the page.

Height Yes

* It is of Integer type.

* It takes the height of the page.

Output

 

True

If the keyword passes successfully

False

If the Keyword fails

Example

Suppose you want to set the Page Layout according to the given dimensions, then you can use SetViewPort keyword as follows:

SetViewPort

Width

412

Height

732

Browser with Width “412” & Height “732”

s14.png

Common Error conditions

Scenarios

Error Message

Debug Information

If Data Input Argument is not given

Argument Data Missing

Argument(s): (Width;Height) is/are blank.

ValidatePageAccessibility

This keyword validates the Page Accessibility at run time and will generate an Accessibility Report which contains the required page Accessibility.

Input Arguments

Object Input Arguments

Required?

Description

Object

No

This keyword does not require any Object input argument.

 

Data Input Arguments

Required?

Description

Data

No

This keyword does not require any Data Input argument.

Output

 

True

If the keyword passes successfully

False

If the Keyword Fails

SampleAccessibilityReport

s12.png

Common Error conditions

There are no error conditions for this keyword.

VisualCheckPointsForObjects

This keyword takes the objects and test the location of the objects relatively to each other on a page. This keyword creates and compare different layout among different objects.

This keyword will take minimum of 10 objects.

Input Arguments

Object Input Arguments

Required?

Description

Object

(1-10)

Yes

This keyword requires an Object as an object input argument.

Note: You can Provide 10 Objects at a time with this keyword

 

Data Input Arguments

Required?

Description

SpecFile

Name

Yes

* It is of String type.

* It takes the name of the Spec (Objects) file.

* It is created once.

SpecFolder

Path

 

Yes

* It is of String type.

*It takes the path(location) where SpecFile will be saved after creation.

Output

 

True

If the keyword passes successfully

False

If the Keyword Fails

Example

Suppose you want to takes the objects and test the location of the objects relatively to each other on a page then, here is how you will use VisualCheckPointsForObjects keyword.

VisualCheckPointsForObjects

SpecFile Name

LIFE

SpecFolder Path

You can find the Values of the Data Input Arguments as follows: 

SpecName

S3.png

SpecFolderPath

s6.png

SampleVisualQAReport

S9.png

s10.png

Common Error conditions

Scenarios

Error Message

Debug Information

If no object is provided

Argument Data Missing

Data not provided for argument:’Object1; Object2; Object3; Object4; Object5; Object6; Object7; Object8; Object9; Object10′. Expected StaticValue was empty

VisualCheckPointsForPage

VisualCheckPointForPage keyword is basically used to compare a page with the already captured same page at runtime.

This keyword compares the page image by breaking image into given numbers of rows and columns.

This keyword when run for the first time will capture the current page snapshot and then the snapshot  will be compared with the same page when it will run for the second time. If there will be any differences, it will highlight the area of differences.

Input Arguments

Object Input Arguments

Required?

Description

Object

No

This keyword doesn’t take any object input argument.

 

Data Input Arguments

Required?

Description

Image

Name

Yes

* It is of String type.

* It takes the name of the image to be captured.

Should

Overlay

 

Yes

* It is of Boolean type.

* By default it is False.

* If it is False, it will highlight the image with Red dotted lines.

* If it is True, it will highlight the image with Green overlay.

Number

OfRows

 

Yes

 

* It is of Integer type.

* It is the number of rows in which image will be divided.

* By default, number of rows are 10.

 

 

NumberOf

Columns

 

 

Yes

* It is of Boolean type.

* By default it is False.

* If it is False, it will create the Spec(Objects) File.

* If it is True, it will compare the Specs(Objects) and will create a Visual QA Report.

Output

True

If the keyword passes successfully

False

If the Keyword Fails

Example

Suppose you want to compare a page with the already captured same page at runtime then, here is how you will use VisualCheckPointForPage keyword.

VisualCheckPointForPage

Image

Name

XYZ

Should

Overlay

False

Number

OfRows

20
NumberOf

Columns

20

Common Error conditions

There are no error conditions for this keyword.

VisualCheckPointSetting

This keyword sets prerequisites for the Visual QA. It takes the required settings need to perform the Visual QA on responsive websites.

Input Arguments

Object Input Arguments

Required?

Description

Object

No

This keyword doesn’t take any object input argument.

 

Data Input Arguments

Required?

Description

SpecFile

Name

Yes

* It is of String type.

* It takes the name of the Spec (Objects) file.

* It is created once.

SpecFolder

Path

 

Yes

* It is of String type.

*It takes the path(location) where SpecFile will be saved after creation.

Platform

 

Yes

 

* It is of String type.

* It takes the view(platform) on which a particular script has to be executed.

* Platform can be Mobile View or Desktop View.

 

 

Validate

Baseline

 

 

Yes

* It is of Boolean type.

* By default it is False.

* If it is False, it will create the Spec(Objects) File.

* If it is True, it will compare the Specs(Objects) and will create a Visual QA Report.

Approximation Range Yes

* It is of Integer type.

* It takes the approximate value upto which errors can be ignored.

Output

 

True

If the keyword passes successfully

False

If the Keyword Fails

Example

Suppose you want to sets prerequisites for the Visual QA then, here is how you will use VisualCheckPointSetting keyword.

VisualCheckPointSetting

SpecFile Name

ABC

SpecFolder Path

Platform Desktop
ValidateBaseline False
Approximation Range 10

You can find the Values of the Data Input Arguments as follows: 

S2.png

S3.png

Common Error conditions

Scenarios

Error Message

Debug Information

If Data Input Argument is not given

Argument Data Missing

Argument(s): (SpecFileName;

Platform;

SpecFolderPath; ValidateBaseline; Approximation

Range) is/are blank

LoadSeleniumJS

This keyword is used to load the OpKey Selenium-JS plugin at runtime which is to be used for the Test Execution. This keyword is generally used when you have a Test Case which has all Generic keywords along with few Selenium-JS keywords which are Selenium-JS specific. This keyword is doesn’t take any object or data input argument.

Scenario:

Suppose there is a Test Case which has both mobile & web test steps. In such case, you need to load both plugins (OpKey Mobility & Selenium-JS plugins) at runtime so that they can be used for executing respective test steps, as required.

You need to add this keyword (LoadSeleniumJS) with a test step, just before stating the Web flows. Save the test case and then click on Run Now. It will take few moments to load the required plugins (as per the added test steps). There will be a popup message regarding the loaded plugins which will be used for executing the test case.

Input Arguments

Object Input Arguments

Required?

Object

no

Data Input Arguments

Required?

Data Input

no

Output

True

If the keyword passes successfully

False

If there is an error

Error Conditions

Conditions

Message

Debug Info

When keyword “LoadSeleniumJS” is not added to the Test Step.

Oops! Seems like ‘SeleniumJS’ is not added in your package or not installed with the agent. Kindly contact OpKey Support Team at support@opkey.com for assistance.

Oops! Seems like ‘‘SeleniumJS’ is not added in your package or not installed with the agent. Kindly contact OpKey Support Team at support@opkey.com for assistance.

Example

Was this article helpful to you? Yes No