How to handle Popup windows with OpKey?

  • by

Quite a times in automation we face applications where an end-user flow is only completed by saying yes/ no in a pop-up window. Most of the open-source tools have complex programs; and insufficient documentation available to handle them. Also, we at times encounter situations where an unexpected pop up come and our automation run is hampered by it. The handling of both kinds of expected and unexpected pop-up windows are available in OpKey and that too with ease. In OpKey Personal Edition, for handling popup which sometimes occurs during the execution, we have two system keywords that can be used as per the need.

  • HandleExpectedPopup
  • RecoveryHandlePopup

HandleExpectedPopup:This system keyword has 3 Inputs:

  • WindowTitle: Specify the title of the window which is to be handled.
  • NumberOfTabs: Specify the number of times the Tab key will be pressed and at last Enter key will be pressed.
  • WaitTime:   Specify the duration with in which this system keyword will handle the specified popup.

How to Use:In a test case, we add a step from where we want to activate Popup Handling and select HandleExpectedPopup system keyword. 

Working: Execution of the step of the test case which contains the HandleExpectedPopup system keyword will activate popup handling. After that, if any popup occurs having the same window title as specified in the input value of the system keyword and its waiting time is remaining then that system keyword will press the Tab key as per the specified number of times and then it will press an Enter key. After that, the execution will continue accordingly. This system keyword can be used for handling only one popup during the execution. 

RecoveryHandlePopup: This system keyword has 2 Inputs:

  • WindowTitle: Specify the title of the window which is to be handled.
  • NumberofTabs: Specify the number of times the Tab key will be pressed and at last Enter key will be pressed.

How to Use:In a test case, we add a step from where we want to activate Popup Handling and select RecoveryHandlePopup system keyword.

 Working: Execution of the step of the test case which contains the RecoveryHandlePopup system keyword will activate popup handling. After that, if any popup occurs during the complete execution of the test suite having the same window title as specified in the input value of the system keyword that system keyword will press the Tab key as per the specified number of times and then it will press an Enter key. After that, the execution will continue accordingly. This system keyword can be used for handling all popups with specified window title during the complete execution of the test suite. 

How to implement this Scenario in OpKey:

  • Create a test case having HandleExpectedPopup System keyword and RecoveryHandlePopup System keyword for handling popup as shown below:
20

Specify the Input Values of these steps of the test case

21
22
  • When these steps will execute then while login in yahoo mail account a message will occur. This popup will be handled by the HandleExpectedPopup System keyword because its window title is the same as specified in the input values. Then the user will continue with their proceedings.
  • Each time Mozilla Firefox opens, it asks for making the browser as default browser if it is already not set, then to handle these kinds of message boxes we can use RecoveryPopupHandle System keyword because it will handle popup in the complete execution.
23
  • Further the normal execution will continues.

Leave a Reply

Your email address will not be published. Required fields are marked *