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
Output
Browser with Width “412” & Height “732”
Input Data
Output Data
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
Input Data
Output Data
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
Input data
Test Object
Input Data
Output Data
Error conditions
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
Test Object
Input Data
Output Data
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
Test Object
Input Data
Output Data
Error conditions
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
Input Data
Output Data
Error conditions
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
Input Data
Output Data
Error conditions
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
Feedback sent
We appreciate your effort and will try to fix the article