本文整理了Java中org.openqa.selenium.remote.RemoteWebDriver.findElement
方法的一些代码示例,展示了RemoteWebDriver.findElement
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteWebDriver.findElement
方法的具体详情如下:
包路径:org.openqa.selenium.remote.RemoteWebDriver
类名称:RemoteWebDriver
方法名:findElement
暂无
代码示例来源:origin: testcontainers/testcontainers-java
@Test
public void testConnection() {
RemoteWebDriver driver = chrome.getWebDriver();
// Construct a URL that the browser container can access
String hostIpAddress = chrome.getTestHostIpAddress();
driver.get("http://" + hostIpAddress + ":" + localPort);
String headingText = driver.findElement(By.cssSelector("h1")).getText().trim();
assertEquals("The hardcoded success message was found on a page fetched from a local server", "It worked", headingText);
}
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
public WebElement findElementByName(String using) {
if (getW3CStandardComplianceLevel() == 0) {
return findElement("name", using);
}
return findElementByCssSelector("*[name='" + using + "']");
}
代码示例来源:origin: testcontainers/testcontainers-java
protected void doSimpleWebdriverTest(BrowserWebDriverContainer rule) {
RemoteWebDriver driver = setupDriverFromRule(rule);
System.out.println("Selenium remote URL is: " + rule.getSeleniumAddress());
System.out.println("VNC URL is: " + rule.getVncAddress());
driver.get("http://www.google.com");
WebElement search = driver.findElement(By.name("q"));
search.sendKeys("testcontainers");
search.submit();
List<WebElement> results = new WebDriverWait(driver, 15)
.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#search h3")));
assertTrue("the word 'testcontainers' appears in search results",
results.stream()
.anyMatch(el -> el.getText().contains("testcontainers")));
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
public WebElement findElementByClassName(String using) {
if (getW3CStandardComplianceLevel() == 0) {
return findElement("class name", using);
}
return findElementByCssSelector("." + cssEscape(using));
}
代码示例来源:origin: testcontainers/testcontainers-java
@Test
public void testWebDriverToNginxContainerAccessViaContainerLink() {
RemoteWebDriver driver = chrome.getWebDriver();
driver.get("http://nginx/");
assertEquals("Using selenium, an HTTP GET from the nginx server returns the index.html from the custom content directory", "This worked", driver.findElement(By.tagName("body")).getText());
}
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
@Override
public WebElement findElementById(String using) {
if (getW3CStandardComplianceLevel() == 0) {
return findElement("id", using);
}
return findElementByCssSelector("#" + cssEscape(using));
}
代码示例来源:origin: la-team/light-admin
@Override
public boolean isElementPresent(By by) {
try {
webDriver.findElement(by);
} catch (NoSuchElementException e) {
return false;
}
return true;
}
代码示例来源:origin: la-team/light-admin
@Override
public WebElement findElement(By by) {
return webDriver.findElement(by);
}
代码示例来源:origin: appium/java-client
@Override public T findElement(By by) {
return (T) super.findElement(by);
}
代码示例来源:origin: appium/java-client
@Override public T findElement(String by, String using) {
return (T) super.findElement(by, using);
}
代码示例来源:origin: la-team/light-admin
@Override
public boolean isElementValuePresent(final String elementName, final String expectedValue) {
return webDriver.findElement(By.name(elementName)).getAttribute("value").equals(expectedValue);
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui
/**
* Same as {@link #findElement(By)} but don't scroll to make the element visible. Useful for example when
* verifying that the page has finished loading (and thus there's no element visible and we cannot scroll to it).
*
* @since 10.8.1
* @since 10.9
*/
public WebElement findElementWithoutScrolling(By by)
{
return this.wrappedDriver.findElement(by);
}
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: findElementWithID @Description: TODO @author
* ahu@greendotcorp.com @param @param params1 @param @return @return
* WebElement return type @throws
*/
public WebElement findElementWithID(String params1) {
// throw new PendingException();
WebElement findElements = driver.findElement(By.id(params1));
return findElements;
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui
@Override
public WebElement findElement(By by)
{
WebElement element = this.wrappedDriver.findElement(by);
return this.scrollTo(element);
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: findElementWithClassName @Description: TODO @author
* ahu@greendotcorp.com @param @param params1 @param @return @return
* WebElement return type @throws
*/
public WebElement findElementWithClassName(String params1) {
// throw new PendingException();
WebElement findElements = driver.findElement(By.className(params1));
return findElements;
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: findElementWithCSS @Description: TODO @author
* ahu@greendotcorp.com @param @param params1 @param @return @return
* WebElement return type @throws
*/
public WebElement findElementWithCSS(String params1) {
// throw new PendingException();
WebElement findElements = driver.findElement(By.cssSelector(params1));
return findElements;
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: findElementWithXPath @Description: TODO @author
* ahu@greendotcorp.com @param @param params1 @param @return @return
* WebElement return type @throws
*/
public WebElement findElementWithXPath(String params1) {
// throw new PendingException();
WebElement findElements = driver.findElement(By.xpath(params1));
return findElements;
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: findElementWithLinkText @Description: TODO @author
* ahu@greendotcorp.com @param @param params1 @param @return @return
* WebElement return type @throws
*/
public WebElement findElementWithLinkText(String params1) {
// throw new PendingException();
WebElement findElements = driver.findElement(By.linkText(params1));
return findElements;
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: findElementContainText @Description: TODO @author
* ahu@greendotcorp.com @param @param params1 @param @return @return
* WebElement return type @throws
*/
public WebElement findElementContainText(String text) {
// throw new PendingException();
WebElement findElements = driver.findElement(By.xpath("//*[contains(text(), '" + text + "')]"));
return findElements;
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: findElementWithName @Description: TODO @author
* ahu@greendotcorp.com @param @param params1 @param @return @return
* WebElement return type @throws
*/
public WebElement findElementWithName(String params1) {
// throw new PendingException();
WebElement findElements = driver.findElement(By.name(params1));
return findElements;
}
内容来源于网络,如有侵权,请联系作者删除!