热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated()方法的使用及代码示例

本文整理了Java中org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated()

本文整理了Java中org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated()方法的一些代码示例,展示了ExpectedConditions.presenceOfElementLocated()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExpectedConditions.presenceOfElementLocated()方法的具体详情如下:
包路径:org.openqa.selenium.support.ui.ExpectedConditions
类名称:ExpectedConditions
方法名:presenceOfElementLocated

ExpectedConditions.presenceOfElementLocated介绍

暂无

代码示例

代码示例来源:origin: TEAMMATES/teammates

/**
* Waits for the element to appear in the page, up to the timeout specified.
*/
public WebElement waitForElementPresence(By by) {
return waitFor(ExpectedConditions.presenceOfElementLocated(by));
}

代码示例来源:origin: appium/java-client

@Test public void hideKeyboardWithParametersTest() {
new WebDriverWait(driver, 30)
.until(ExpectedConditions.presenceOfElementLocated(By.id("IntegerA")))
.click();
driver.hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done");
}

代码示例来源:origin: appium/java-client

@Ignore
@Test public void whenIOSHybridAppIsLaunched() {
assertTrue(check(serverAppCapabilitiesSupplier,
appFileSupplierFunction.apply(webViewApp),
(by, aClass) -> {
new WebDriverWait(driver, 30)
.until(ExpectedConditions.presenceOfElementLocated(id("login")))
.click();
driver.findElementByAccessibilityId("webView").click();
new WebDriverWait(driver, 30)
.until(ExpectedConditions
.presenceOfElementLocated(AccessibilityId("Webview")));
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.getContextHandles().forEach((handle) -> {
if (handle.contains("WEBVIEW")) {
driver.context(handle);
}
});
return commonPredicate.test(by, aClass);
}, partialLinkText("login"), IOSElement.class));
}

代码示例来源:origin: appium/java-client

@Test public void webViewPageTestCase() throws InterruptedException {
new WebDriverWait(driver, 30)
.until(ExpectedConditions.presenceOfElementLocated(By.id("login")))
.click();
driver.findElementByAccessibilityId("webView").click();
new WebDriverWait(driver, 30)
.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Webview")));
findAndSwitchToWebView();
WebElement el = driver.findElementByPartialLinkText("login");
assertTrue(el.isDisplayed());
}
}

代码示例来源:origin: appium/java-client

driver.startActivity(activity);
wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy
.AccessibilityId("Make a Popup!")));
MobileElement popUpElement = driver.findElement(MobileBy.AccessibilityId("Make a Popup!"));
wait.until(ExpectedConditions.visibilityOfElementLocated(
By.xpath(".//*[@text='Search']"))).click();
assertNotNull(wait.until(ExpectedConditions.presenceOfElementLocated(
By.xpath("//*[@text='Clicked popup menu item Search']"))));
By.xpath(".//*[@text='Add']"))).click();
assertNotNull(wait.until(ExpectedConditions
.presenceOfElementLocated(By.xpath("//*[@text='Clicked popup menu item Add']"))));
By.xpath(".//*[@text='Edit']"))).click();
assertNotNull(wait.until(ExpectedConditions
.presenceOfElementLocated(By.xpath("//*[@text='Clicked popup menu item Edit']"))));
.presenceOfElementLocated(By.xpath("//*[@text='Clicked popup menu item Share']"))));

代码示例来源:origin: net.serenity-bdd/serenity-core

/**
* This method will wait until an element is present on the screen, though not necessarily visible.
*/
public void waitForPresenceOf(final By byElementCriteria) {
WebDriverWait wait = new WebDriverWait(driver, waitForTimeout.getSeconds());
wait.until(ExpectedConditions.presenceOfElementLocated(byElementCriteria));
}

代码示例来源:origin: com.arcbees/testutils

private WebElement doFindElement() {
if (timeout > 0) {
return new WebDriverWait(webDriver, timeout)
.until(ExpectedConditions.presenceOfElementLocated(by));
} else {
return webDriver.findElement(by);
}
}

代码示例来源:origin: com.cognifide.aet/jobs

public static void waitForElementToBePresent(WebDriver webDriver, By elementLocator, long timeOut)
throws WebDriverException {
WebDriverWait wait = new WebDriverWait(webDriver, timeOut);
wait.until(ExpectedConditions.presenceOfElementLocated(elementLocator));
}

代码示例来源:origin: net.thucydides/thucydides-core

/**
* This method will wait until an element is present on the screen, though not necessarily visible.
*/
public void waitForPresenceOf(final By byElementCriteria) {
WebDriverWait wait = new WebDriverWait(driver, (long)(waitForTimeoutInMilliseconds/1000));
wait.until(ExpectedConditions.presenceOfElementLocated(byElementCriteria));
// waitForCondition().until(elementPresent(byElementCriteria));
}

代码示例来源:origin: org.wso2.es/ui-test-utils

/**
* This method will wait until a given element is present in the page for a given amount of time
*
* @param by Element to be present in the current page
* @param waitTimeSec Time to wait in seconds
*/
private void waitTillElementPresent(By by, int waitTimeSec) {
WebDriverWait wait = new WebDriverWait(driver, waitTimeSec);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
}

代码示例来源:origin: ru.sbtqa.tag.pagefactory/page-factory-core

/**
* Wait until element will be present on the DOM of a page
*
* @param xpath element xpath
* @param message message in case there is no text in the element after waiting
* @param timeout condition timeout in seconds
*/
public static void presence(String xpath, String message, int timeout) {
wait(ExpectedConditions.presenceOfElementLocated(By.xpath(xpath)), message, timeout);
}

代码示例来源:origin: se.redmind/rmtest-selenium

/**
* @param pBy
* @param timeoutInSeconds
*/
public void driverWaitElementPresent(By pBy, int timeoutInSeconds) {
driverWait(timeoutInSeconds).until(ExpectedConditions.presenceOfElementLocated(pBy));
}

代码示例来源:origin: com.github.mike10004/chrome-COOKIE-implant-client

protected COOKIEImplantOutput waitForCOOKIEImplantOutput(WebDriver driver, int timeOutInSeconds) {
By by = byOutputStatus(COOKIEProcessingStatus.all_implants_processed::equals);
Function fn = ExpectedConditions.presenceOfElementLocated(by);
WebElement outputElement = new WebDriverWait(driver, timeOutInSeconds)
.until(fn);
String outputJson = outputElement.getText();
COOKIEImplantOutput output = gson.fromJson(outputJson, COOKIEImplantOutput.class);
return output;
}

代码示例来源:origin: EnMasseProject/enmasse

@Override
public void checkReachableWebPage() {
selenium.getDriverWait().withTimeout(Duration.ofSeconds(60)).until(ExpectedConditions.presenceOfElementLocated(By.className("navbar-pf-vertical")));
}
}

代码示例来源:origin: selenium-cucumber/selenium-cucumber-java

/** method to get element status - displayed?
@param accessType : String : Locator type (id, name, class, xpath, css)
@param accessName : String : Locator value
@return Boolean
*/
public boolean isElementDisplayed(String accessType,String accessName)
{
element = wait.until(ExpectedConditions.presenceOfElementLocated(getelementbytype(accessType, accessName)));
return element.isDisplayed();
}

代码示例来源:origin: selenium-cucumber/selenium-cucumber-java

/** Method to scroll page to particular element
* @param accessType : String : Locator type (id, name, class, xpath, css)
* @param accessName : String : Locator value
*/
public void scrollToElement(String accessType, String accessName)
{
element = wait.until(ExpectedConditions.presenceOfElementLocated(getelementbytype(accessType, accessName)));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].scrollIntoView();", element);
}

代码示例来源:origin: persado/stevia

@Override
public boolean isComponentPresent(String locator, long seconds) {
try {
WebDriverWait wait = new WebDriverWait(driver, seconds);
wait.until(ExpectedConditions.presenceOfElementLocated(determineLocator(locator)));
return true;
} catch (Exception e) {
return false;
}
}

代码示例来源:origin: net.serenity-bdd/core

/**
* This method will wait until an element is present on the screen, though not necessarily visible.
*/
public void waitForPresenceOf(final By byElementCriteria) {
WebDriverWait wait = new WebDriverWait(driver, waitForTimeout.in(TimeUnit.SECONDS));
wait.until(ExpectedConditions.presenceOfElementLocated(byElementCriteria));
}

代码示例来源:origin: tarun3kumar/seleniumtestsframework

public static void waitForElementPresent(final HtmlElement element) {
Assert.assertNotNull(element, "Element can't be null");
TestLogging.logWebStep(
"wait for " + element.toString() + " to be present.", false
);
final WebDriverWait wait = new WebDriverWait(WebUIDriver.getWebDriver(), EXPLICT_WAIT_TIMEOUT);
wait.until(
ExpectedConditions.presenceOfElementLocated(
element.getBy()
)
);
}

代码示例来源:origin: Wikia/selenium-tests

@Override
public Boolean apply(@Nullable WebDriver input) {
return ExpectedConditions.presenceOfElementLocated(By.className(cssClassName))
.apply(input)
.isDisplayed();
}
});

推荐阅读
author-avatar
szh
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有