use of org.openqa.selenium.support.ui.WebDriverWait in project rstudio by rstudio.
the class SourceInteraction method findAndReplace.
@Test
public void findAndReplace() {
createRFile();
// Type some code into the file
String preReplaceCode = "foo <- 'bar'";
Actions a = new Actions(driver_);
a.sendKeys(preReplaceCode + Keys.ENTER);
a.perform();
// Find the ACE editor instance that the code appears in. (CONSIDER:
// This is not the best way to find the code editor instance.)
WebElement editor = null;
List<WebElement> editors = driver_.findElements(By.className("ace_content"));
for (WebElement e : editors) {
if (e.getText().contains(preReplaceCode)) {
editor = e;
break;
}
}
Assert.assertNotNull(editor);
// Invoke find and replace
WebElement findMenuEntry = MenuNavigator.getMenuItem(driver_, "Edit", "Find...");
findMenuEntry.click();
// Wait for the find and replace panel to come up
(new WebDriverWait(driver_, 2)).until(ExpectedConditions.presenceOfElementLocated(By.id(ElementIds.getElementId(ElementIds.FIND_REPLACE_BAR))));
// Type the text and the text to be replaced (replace 'bar' with 'foo')
Actions rep = new Actions(driver_);
rep.sendKeys("bar" + Keys.TAB + "foo" + Keys.ENTER);
rep.perform();
DialogTestUtils.respondToModalDialog(driver_, "OK");
Actions dismiss = new Actions(driver_);
dismiss.sendKeys(Keys.ESCAPE);
dismiss.perform();
// Ensure that the source has been updated
Assert.assertTrue(editor.getText().contains("foo <- 'foo'"));
closeUnsavedRFile();
}
use of org.openqa.selenium.support.ui.WebDriverWait in project page-factory-2 by sbtqa.
the class TagWebDriver method closeAllAlerts.
private static void closeAllAlerts() {
try {
LOG.info("Checking any alert opened");
WebDriverWait alertAwaiter = new WebDriverWait(webDriver, 2);
alertAwaiter.until(ExpectedConditions.alertIsPresent());
Alert alert = webDriver.switchTo().alert();
LOG.info("Got an alert: '{}'. Closing it...", alert.getText());
alert.dismiss();
} catch (WebDriverException e) {
LOG.debug("No alert opened. Closing webdriver...", e);
}
}
use of org.openqa.selenium.support.ui.WebDriverWait in project android by nextcloud.
the class Actions method login.
public static FileListView login(String url, String user, String password, Boolean isTrusted, AndroidDriver driver) throws InterruptedException {
LoginForm loginForm = new LoginForm(driver);
CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url);
if (!isTrusted) {
WebDriverWait wait = new WebDriverWait(driver, 30);
// and it doesn't appear again
try {
wait.until(ExpectedConditions.visibilityOf(certificatePopUp.getOkButtonElement()));
// we need to repaint the screen
// because of some element are misplaced
driver.rotate(ScreenOrientation.LANDSCAPE);
driver.rotate(ScreenOrientation.PORTRAIT);
certificatePopUp.clickOnOkButton();
} catch (NoSuchElementException e) {
}
}
loginForm.typeUserName(user);
loginForm.typePassword(password);
// TODO. Assert related to check the connection?
return loginForm.clickOnConnectButton();
}
use of org.openqa.selenium.support.ui.WebDriverWait in project android by nextcloud.
the class Common method setUpCommonDriver.
protected AndroidDriver setUpCommonDriver() throws Exception {
File rootPath = new File(System.getProperty("user.dir"));
File appDir = new File(rootPath, "src/test/resources");
File app = new File(appDir, "ownCloud.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "test");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.owncloud.android");
capabilities.setCapability("appActivity", ".ui.activity.FileDisplayActivity");
capabilities.setCapability("appWaitActivity", ".authentication.AuthenticatorActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(waitingTime, TimeUnit.SECONDS);
wait = new WebDriverWait(driver, waitingTime, 50);
return driver;
}
use of org.openqa.selenium.support.ui.WebDriverWait in project iTest by e-government-ua.
the class TemplatePage method ecpAuthorization.
public void ecpAuthorization() {
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(buttonAuthMock));
// cm.click(driver, buttonAuthMock);
cm.click(driver, buttonBankID);
cm.clickXpath(driver, "//li[1]/a//span[contains(.,'ПриватБанк')]");
cm.click(driver, driver.findElement(By.xpath(".//legend[text()='ЕЦП']")));
// находим элемент <input type="file">
WebElement element = driver.findElement(By.xpath("//button[contains(@onclick,'startClientSign()')]"));
new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(element));
element.sendKeys("src/test/resources/files/Key-6.dat");
}
Aggregations