/** * Method to switch to Google Drive window * * @param drone WebDrone * @return EditGoogleDocsPage */ private static EditInGoogleDocsPage switchToGoogleWindow(WebDrone drone) { Set<String> setWindowHandles = drone.getWindowHandles(); int retry = 0; while (setWindowHandles.size() < 2) { webDriverWait(drone, 3000); retry++; setWindowHandles = drone.getWindowHandles(); if (retry == 3) { throw new PageOperationException("Google doc isn't opened in new window for Editing"); } } String[] windowHandles = setWindowHandles.toArray(new String[setWindowHandles.size()]); drone.switchToWindow(windowHandles[1]); return FactorySharePage.resolvePage(drone).render(); }
/** * Method to close Google Drive window and switch to Alfresco * * @param drone WebDrone * @return SharePage */ private static SharePage closeAndSwitchToShare(WebDrone drone) { Set<String> setWindowHandles = drone.getWindowHandles(); drone.closeWindow(); drone.switchToWindow(setWindowHandles.toArray(new String[setWindowHandles.size()])[0]); return FactorySharePage.resolvePage(drone).render(); }