List of Keywords - Web Keywords

To learn how to use Web keywords in Opkey, you can read Using Web Keywords - New UI and Using Web Keywords - Opkey Classic


Now let's go through the list of various web keywords:

1. SetViewPort


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

Example

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

SetViewPort

Width

412

Height

732


Output

Browser with Width “412” & Height “732”

Input Data


Input Data Required

Description

Width

* It is of Integer type.

* It takes the width of the page.

Height

* It is of Integer type.

* It takes the height of the page.



Output Data

Condition

Output value

If the keyword passes successfully

True

If the keyword passes successfully

False

  

Error Conditions

 

Conditions 

Error Message  

Debug Information  

If the Data Input Argument is not given 

 Argument Data Missing 

 

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

 

2. ValidatePageAccessibility

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

Example

You can use this keyword if you want to validate the accessibility report of a web page at the run time.

Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required?

Description

No

This keyword doesn’t take any input data argument.



Output Data

Condition

Output value

If the keyword passes successfully

True

If the keyword passes successfully

False


  

Error conditions

There are no error conditions for this keyword.

3. VisualCheckPointsForObjects

This keyword takes the objects and tests the location of the objects relative to each other on a page. This keyword creates and compares different layouts among different objects.

This keyword will take a minimum of 10 objects.

Example

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

VisualCheckPointsForObjects

Object 

Object

Object 1, Object 2


Input data


SpecFile Name

ABC

Spec FolderPath

/ABC/ast/DriveD


Test Object


Test Object Required?

Description

Object (1-10)

This keyword requires an Object as an object input argument.

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


Input Data


Input Data Required

Description

Spec FileName

* It is of String type.

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

SpecFolderPath

* It is of String type.

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




Output Data

Condition

Output value

If the keyword passes successfully

True

If the keyword passes successfully

False

  

Error conditions


Conditions

Error Message 

Debug Information 

If no object is provided

  Argument Data Missing

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


4. VisualCheckPointsForPage

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

This keyword compares the page image by breaking an 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.

Example

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

VisualCheckPointForPage

Image Name

XYZ

Should Overlay

False

Number

OfRows


20

NumberOfColumns

20


Test Object


Test Object Required?

Description

No

This keyword doesn't object input argument.


Input Data


Input Data Required

Description

ImageName


* It is of String type.

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

Should Overlay

* 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 a Green overlay.

NumberOfRows

* It is of Integer type.

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

* By default, number of rows are 10.

NumberOfColumns

* 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 Data

Condition

Output value

If the keyword passes successfully

True

If keyword passes successfully

False


 

  

Error conditions

There are no error conditions for this keyword.


6. VisualCheckPointSetting


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

Example

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

VisualCheckPointSetting

SpecFileName

ABC

SpecFolderPath

/ABC/ast/DriveD

Platform

Desktop

ValidateBaseline

False

Approximation Range

10


Test Object


Test Object Required?

Description

No

This keyword doesnt object input argument.




Input Data

Input Data Required

Description

SpecFileName


* It is of String type.

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

* It is created once.




SpecFolderPath


* It is of String type.

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




Platform

* It is of String type.

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



ValidateBaseLine

* 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.



Approximate Range

* 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 Data

Condition

Output value

If the keyword passes successfully

True

If keyword passes successfully

False


 


  

Error conditions

Conditions

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

   


7. LoadSeleniumJS

This keyword loads the Opkey Selenium-JS plugin during test execution. It's useful when a test case includes both generic and Selenium-JS specific keywords. No input object or data is needed for this keyword. 

Example

If your Test Case includes both mobile and web test steps, load both OpKey Mobility and Selenium-JS plugins during runtime. This allows you to execute the necessary test steps accordingly.


Add "LoadSeleniumJS" keyword before starting the Web flows in your test case. Save it and click "Run Now." It will take a moment to load the required plugins. A popup will confirm the loaded plugins for executing the test case.


Test Object


Test Object Required?

Description

No

This keyword doesnt required object input argument.




Input Data


Input Data Required?

Description

No


This keyword doesnt required data input argument.







Output Data

Condition

Output value

If the keyword passes successfully

True

If keyword passes successfully

False


 


  

Error conditions


Conditions

Error Message 

Debug Information 

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.

   


8. VisualComparisonForPage


This Keyword is used to compare the specified web page with the same web page at runtime based on the specified parameters. It doesn’t take any object input argument. It takes few mandatory and optional data input arguments.

Note:

There would be two Test Iterations. First iteration is used to fetch Website visual attributes while in iteration 2, it compares previous fetched visual attributes (iteration 1) with the current visual attributes and prepares HTML report.

Example

Suppose, you want to compare User Interface of the Apple Login page then you can use VisualComparisonForPage keyword. In first iteration, it captures an image of Apple Login page and stores at given path. In second iteration, it creates three different images (BaselineImage, ActualImage & Comparison) and provides compared image of the site.

In iteration 1, it captures a screenshot of the web page, stores it at the specified location with the given name. In iteration 2, it creates a folder named as Result which further contains a sub-folder named as per your Test Case. this sub folder contains three images named as ActualImage, BaselineImage & ComparedImage along with a HTML file named as visualOutput.

ActualImage: This image is the actual screenshot of the web page.
BaselineImage: This image is the screenshot of the web page fetched at iteration 1.
ComparedImag: This image is the compared screenshot captured at iteration 2.

visualOutput HTML file contains all the tree images (ActualImage, BaselineImage & ComparedImage).

For example, in the above screenshot, if you want to compare the visual aspects of the Apple Sign in page then select then you can use the keyword “VisualComparisonForPage” as follows:

Note:
While using this keyword, you need to create a Test Case and use this keyword with valid arguments which will capture the screenshot. After That, you need to execute the same Test Case by providing valid data input arguments which will compare the previously captured screenshot with the runtime screenshot. Valid data input arguments as given below:

Data Input Arguments (For capturing screenshot) in Iteration 1:

Data Input Arguments (For comparing screenshot) in Iteration 2:


Test Object


Test Object Required?

Description

No

This keyword does not take any object input argument.




Input Data


Input Data Required

Description

ImageName


Iteration1:Provide the name of the image to be fetched during iteration 1 to be compared.

Iteration2: Provide the name of the runtime (iteration 2) fetched image to be compared with the existing baseline image (fetched in iteration 1).





ImagePath


Iteration1:Provide the storage path of the image to be fetched during iteration 1 to be compared.

Iteration2: Provide the storage path of the image (fetched in iteration 2) to be compared with the existing baseline image (fetched in iteration 1).





ValidateBaseline

Iteration1:Set False for capturing screenshot of the web page.

Iteration2: Set True for comparing image screenshot with the existing baseline image.




ValueFullPageScreenshot

Set False






Output Data

Condition

Output value

If the keyword passes successfully

True

If keyword passes successfully

False


 


  

Error conditions


Conditions

Error Message 

Debug Information 

If 

    When ImageName is blank & ImagePath is invalid under Data Input arguments.

  Argument Data Missing

Argument(s) : (ImageName;) is/are blank.

When the ImagePath is blank, ValidateBaseline & FullPageScreenShot are True

Argument Data Invalid (-13300)

   Given Path is Not Valid. Please Check


Click Here to learn more about Opkey features.

To learn more about using these keywords in a test case, you can visit https://university.opkeylms.com and enroll in our Opkey series course.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article