org.openqa.selenium.By.findElement()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(131)

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

By.findElement介绍

[英]Find a single element. Override this method if necessary.
[中]查找单个元素。如有必要,请重写此方法。

代码示例

代码示例来源:origin: org.seleniumhq.selenium/selenium-htmlunit-driver

@Override
 public WebElement call() throws Exception {
  return locator.findElement(context);
 }
});

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-api

@Override
public WebElement findElement(SearchContext context) {
  return implementation.findElement(context);
}

代码示例来源:origin: com.machinepublishers/jbrowserdriver

/**
 * {@inheritDoc}
 */
@Override
public ElementServer findElement(By by) {
 return (ElementServer) by.findElement(this);
}

代码示例来源:origin: arquillian/arquillian-graphene

@Override
public WebElement findElement(SearchContext context) {
  return implementation.findElement(context);
}

代码示例来源:origin: com.machinepublishers/jbrowserdriver

/**
 * {@inheritDoc}
 */
@Override
public WebElement findElement(By by) {
 return by.findElement(this);
}

代码示例来源:origin: org.seleniumhq.webdriver/webdriver-support

@Override
public WebElement findElement(SearchContext finder) {
 try {
  // First, try to locate by id
  return idFinder.findElement(finder);
 } catch (NoSuchElementException e) {
  // Then by name
  return nameFinder.findElement(finder);
 }
}

代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-common

/**
 * Find a single element. Override this method if necessary.
 * @param driver A driver to use to find the element
 * @return The WebElement that matches the selector
 * @deprecated use findElement(SearchContext) instead
 */
public WebElement findElement(WebDriver driver) {
  return findElement((SearchContext) driver);
}

代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-support

@Override
public WebElement findElement(SearchContext finder) {
 try {
  // First, try to locate by id
  return idFinder.findElement(finder);
 } catch (NoSuchElementException e) {
  // Then by name
  return nameFinder.findElement(finder);
 }
}

代码示例来源:origin: org.seleniumhq.webdriver/webdriver-ie

public WebElement findElement(By by) {
 return by.findElement(this);
}

代码示例来源:origin: com.machinepublishers/jbrowserdriver

/**
 * {@inheritDoc}
 */
@Override
public WebElement findElement(By by) {
 return by.findElement(this);
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-angularjs-graphene-api

@Override
public WebElement findElement(SearchContext context) {
  return implementation.findElement(context);
}

代码示例来源:origin: com.cognifide.qa.bb/bb-core

@Override
public WebElement findElement() {
 return selector.findElement(searchContext);
}

代码示例来源:origin: com.cognifide.qa.bb/bb-core

private SearchContext getContext() {
  return field.isAnnotationPresent(Global.class) ? searchContext
    : selector.findElement(searchContext);
 }
}

代码示例来源:origin: stackoverflow.com

public class MyFirefoxDriver extends FirefoxDriver {

@Override
public WebElement findElement(By by) {
  try {
    Thread.sleep(1000);
  } catch (InterruptedException e) {
    e.printStackTrace();
  }
  return by.findElement((SearchContext) this);
}

代码示例来源:origin: stackoverflow.com

public class _WebDriver extends FirefoxDriver {

@Override
public WebElement findElement(By by) {
  try {
    Thread.sleep(500);
  } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return by.findElement((SearchContext) this);
}

}

代码示例来源:origin: org.seleniumhq.selenium/selenium-android-driver

public WebElement findElement(By by) {
 long start = System.currentTimeMillis();
 while (true) {
  try {
   return by.findElement(findBy);
  } catch (NoSuchElementException e) {
   if (System.currentTimeMillis() - start > implicitWait) {
    throw e;
   }
   sleepQuietly(100);
  }
 }
}

代码示例来源:origin: org.seleniumhq.selenium.fluent/fluent-selenium

@Override
public WebElement findElement(SearchContext context) {
  return makeXPath().findElement(context);
}

代码示例来源:origin: org.seleniumhq.selenium.fluent/fluent-selenium

@Override
public WebElement findElement(SearchContext context) {
  return makeByXPath().findElement(context);
}

代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-htmlunit

public WebElement findElement(By by) {
 assertElementNotStale();
   return by.findElement(this);
 }

代码示例来源:origin: fhoeben/hsac-fitnesse-fixtures

protected boolean clickSelectOption(WebElement element, String optionValue) {
  boolean result = false;
  if (element != null) {
    if (isSelect(element)) {
      optionValue = cleanupValue(optionValue);
      By optionBy = new OptionBy(optionValue);
      WebElement option = optionBy.findElement(element);
      result = clickSelectOption(element, option);
    }
  }
  return result;
}

相关文章