1) Open parent window and perform some operation on it so that it should open the child window.
3) Perform some operation on this child window so that it opens up a another pop up child window.
4) Now I need to perform some operation on this window but it is giving me error as "Element is not currently visible and so may not be interacted with".
//On the store detail page searched your store by typing out some keywords and then click the link which has came up as searched item.
//New window will open ..to upload window wait
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
//In new window click on Actions drop down and select "Sync Google Sheet" option.
//But before that pass the control of the webdriver to this new window using Switchto() method
//Before that get each windows ID from webdriver using gethandles () method
Set<String> set= driver.getWindowHandles();
//As set in not indexable collection; create iterator to access items(Strings) in set
Iterator<String> it=set.iterator();
//Use next() method of iterator to access elements one by one from set
String parentwin=it.next();
String childwin=it.next();
//Pass webdriver control to child window and click on Actions drop down and select "Sync Google Sheet" option.
driver.switchTo().window(childwin);
/*WebDriverWait wait= new WebDriverWait(driver,20);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(".//*[@id='products_ingested']/div[1]/div/div/div[2]/div/button")));*/
Thread.sleep(5000);
driver.findElement(By.xpath(".//*[@id='products_ingested']/div[1]/div/div/div[2]/div/button")).click();
Thread.sleep(3000);
driver.findElement(By.xpath(".//*[@id='products_ingested']/div[1]/div/div/div[2]/div/ul/li[2]/a")).click();
//New window will open; now pass control to this new window and perform operation on it.
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
Set<String> set1= driver.getWindowHandles();
Iterator<String> it1=set1.iterator();
String parentwin1=it1.next();
String childwin1=it1.next();
String childwin2=it1.next();
System.out.println(childwin1);
System.out.println(childwin2);
System.out.println(parentwin1);
//pass control to this third window
driver.switchTo().window(childwin2);
Thread.sleep(5000);
//Writing code to perform operations on this third window
Select sel = new Select(driver.findElement(By.id("spreadsheet_select")));
Thread.sleep(5000);
sel.selectByVisibleText("Test Sheet {AKASH.SRIVASTAVA}");
Thread.sleep(4000);
Select sel1 = new Select(driver.findElement(By.id("worksheet_select")));
sel1.selectByVisibleText("Test Sheet by Akash");
}
}