Interview Questions

How to close unexpected window??

SilkTest Questions and Anwsers


(Continued from previous question...)

14. How to close unexpected window??

You meant to say one more browser window (Order Request) appearing apart from original window (Order Status)?

Answer1
If Order Request window is a popup.

Following code closes the active browser window if it is a popup:
[-] !(if Browser.ComboBox("#1").exists())
[ ] Browser.SetActive()
[ ] Browser.typekeys("")

Answer2
If Order Request window is a Browser window.(not a popup)
You can use the following code to close unwanted Browsers(like Order Request)

Order_Status.SetActive()
Browser.CloseOthers()

(Continued on next question...)

Other Interview Questions