Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How do you handle Multiple windows in your application?

Answer Posted / deepa

driver.findElement(By.id(“id of the link which opens new window”)).click();

//wait till two windows are not opened

waitForNumberofWindowsToEqual(2);//this method is for wait

Set handles = driver.getWindowHandles();

firstWinHandle = driver.getWindowHandle(); handles.remove(firstWinHandle);

String winHandle=handles.iterator().next();

if (winHandle!=firstWinHandle){

//To retrieve the handle of second window, extracting the handle which does not match to first window handle

secondWinHandle=winHandle; //Storing handle of second window handle

//Switch control to new window

driver.switchTo().window(secondWinHandle);

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do perform drag and drop using webdriver?

1050


what is your approach clicking all the links which are available on the page?

928


When to use autoit?

1051


What are the main advantages of automation testing?

1034


Tell us how many exceptions do you know in selenium webdriver?

872


What are the different ways of locating a web element in selenium?

896


How to type in a textbox using selenium?

1047


What is fluent wait in selenium webdriver?

1016


How to handle https website in selenium? Or how to accept the ssl untrusted connection?

870


List some scenarios which we cannot automate using selenium webdriver?

991


How can you handle network latency using selenium?

1014


Why to use testng with selenium rc?

971


Explain what is framework and what are the frameworks available in rc?

951


How can you prepare customized html report using testng in hybrid framework?

865


How to highlight element using selenium webdriver?

1022