use of org.openqa.selenium.support.ui.WebDriverWait in project selenium-tests by Wikia.
the class CreateNewWikiPageObjectStep3 method submit.
public ArticlePageObject submit() {
changeImplicitWait(250, TimeUnit.MILLISECONDS);
try {
new WebDriverWait(driver, 180).until(CommonExpectedConditions.elementNotPresent(loadingIndicatorBy));
} finally {
restoreDefaultImplicitWait();
}
scrollAndClick(submitButton);
PageObjectLogging.log("submit", "Submit button clicked", true, driver);
return new ArticlePageObject();
}
use of org.openqa.selenium.support.ui.WebDriverWait in project SneakerBot by Penor.
the class Adidas method atc.
public void atc() {
WebDriverWait wait = new WebDriverWait(driver, 300L);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@class='ffSelectButton' and (.//span[text()[contains(.,'Size')]] or .//span[text()[contains(.,'size')]])]")));
int index = new Random().nextInt(sizes.length);
String sizeToPick = Double.toString(sizes[index]);
for (WebElement e : driver.findElements(By.xpath("//div[@class='ffSelectMenuMid' and .//ul[.//li[.//span[text()[contains(.,'size')]]]]]/ul/li"))) {
String size = e.getText().trim();
if (size != null && size.equals(sizeToPick)) {
e.click();
break;
}
}
}
use of org.openqa.selenium.support.ui.WebDriverWait in project rstudio by rstudio.
the class MenuNavigator method getMenuItem.
public static WebElement getMenuItem(final WebDriver driver, String level1, String level2, String level3) {
WebElement popupItem = getMenuItem(driver, level1, level2);
Actions action = new Actions(driver);
action.moveToElement(popupItem).build().perform();
// Wait for there to be two popups open (the level1 and level2 menus)
(new WebDriverWait(driver, 1)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
List<WebElement> elements = driver.findElements(By.className("gwt-MenuBarPopup"));
return elements.size() > 1;
}
});
// Get the second popup menu
List<WebElement> elements = driver.findElements(By.className("gwt-MenuBarPopup"));
WebElement menu2popup = elements.get(1);
return findMenuItemByName(menu2popup, level3);
}
use of org.openqa.selenium.support.ui.WebDriverWait in project ORCID-Source by ORCID.
the class OauthAuthorizationPageHelper method clickAuthorizeOnAuthorizeScreen.
private static void clickAuthorizeOnAuthorizeScreen(final WebDriver webDriver) {
By userIdElementLocator = By.id("authorize");
(new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(userIdElementLocator));
WebElement authorizeButton = webDriver.findElement(By.id("authorize"));
authorizeButton.click();
(new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().equals("ORCID Playground");
}
});
}
use of org.openqa.selenium.support.ui.WebDriverWait in project ORCID-Source by ORCID.
the class BlackBoxBase method changeNamesVisibility.
public static void changeNamesVisibility(Visibility changeTo) throws Exception {
int privacyIndex = getPrivacyIndex(changeTo);
try {
By openEditNames = By.xpath("//div[@id = 'names-section']//div[@id = 'open-edit-names']");
(new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(openEditNames));
WebElement openEditNamesElement = webDriver.findElement(openEditNames);
openEditNamesElement.click();
By namesVisibility = By.xpath("//div[@id = 'names-section']//ul[@class='privacyToggle']/li[" + privacyIndex + "]/a");
(new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(namesVisibility));
WebElement namesVisibilityElement = webDriver.findElement(namesVisibility);
namesVisibilityElement.click();
By saveButton = By.xpath("//div[@id = 'names-section']//ul[@class='workspace-section-toolbar']//li[1]//button");
(new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS)).until(ExpectedConditions.presenceOfElementLocated(saveButton));
WebElement button = webDriver.findElement(saveButton);
button.click();
Thread.sleep(1000);
} catch (Exception e) {
System.out.println("Unable to find names-visibility-limited element");
e.printStackTrace();
throw e;
}
}
Aggregations