Tuesday, 15 July 2014

java - Handle Window Pop Up in Selenium -


I am working with Selenium, now is a condition:

When I open my button webpage A window pops up opens

Now I have to click a radio button (one of two, it will work even when we send a tab) and then click an OK button I click on the net Searched and found out about " driver. GetWindowHandle () ".

But I have no idea with the new open window popup. I need help for this.

You can use extended for loop to switch the purpose:

< For pre> (string zoo: objDriver.getWindowHandles ()) {objDriver.switchTo () Window (winHandle); }

Then it will switch control in the hair window from a driver window.

To interact with window elements, try to find an element using that tool and after switching to the window take the necessary action.

You can use the same loop back in the original window or use:

  driver.switchTo (). DefaultContent ();  

No comments:

Post a Comment