org.openqa.selenium.remote.RemoteWebDriver.getCapabilities()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(188)

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

RemoteWebDriver.getCapabilities介绍

暂无

代码示例

代码示例来源:origin: testcontainers/testcontainers-java

protected void assertBrowserNameIs(BrowserWebDriverContainer rule, String expectedName) {
  RemoteWebDriver driver = setupDriverFromRule(rule);
  String actual = driver.getCapabilities().getBrowserName();
  assertTrue(format("actual browser name is %s", actual),
    actual.equals(expectedName));
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

@Override
public Capabilities getCapabilities()
{
  return this.wrappedDriver.getCapabilities();
}

代码示例来源:origin: org.rapidpm/testbench-ng-m-webdriver

static Function<RemoteWebDriver, String> formatRemoteWebDriverName() {
 return (webDriver) -> webDriver.getCapabilities().getBrowserName()
            + " "
            + webDriver.getCapabilities().getVersion()
            + " / "
            + webDriver.getCapabilities().getPlatform();
}

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

private String nameOf(WebDriver driver) {
  if (driver instanceof WebDriverFacade) {
    return ((WebDriverFacade) driver).getDriverName();
  }
  if ((driver instanceof RemoteWebDriver) && ((RemoteWebDriver) driver).getCapabilities() != null) {
    return ((RemoteWebDriver) driver).getCapabilities().getBrowserName();
  }
  return driver.toString();
}

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

@Override
public String toString() {
 Capabilities caps = getCapabilities();
 if (caps == null) {
  return super.toString();
 }
 return String.format("%s: %s on %s (%s)", getClass().getSimpleName(),
   caps.getBrowserName(), caps.getPlatform(), getSessionId());
}

代码示例来源:origin: qaprosoft/carina

/**
 * Returns device information from Grid Hub using STF service.
 * 
 * @param drv
 *            - driver
 * @return remote device information
 */
@SuppressWarnings("unchecked")
private RemoteDevice getDeviceInfo(RemoteWebDriver drv) {
  return getDeviceInfo((Map<String, Object>) drv.getCapabilities().getCapability(SpecialKeywords.SLOT_CAPABILITIES));
}

代码示例来源:origin: org.uiautomation/ios-client

@Override
public IOSCapabilities getCapabilities() {
 Capabilities cap = super.getCapabilities();
 if (cap == null) {
  return null;
 }
 IOSCapabilities ioscap = new IOSCapabilities(cap.asMap());
 return ioscap;
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui

public BrowserTestRule(WebDriver driver)
{
  Capabilities capability = ((RemoteWebDriver) driver).getCapabilities();
  // We get the name of the current user Browser
  this.currentBrowserName = capability.getBrowserName();
  // We get the version of the current used Browser
  this.currentBrowserVersion = capability.getVersion();
}

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

public WebDriver newRemoteDriver(URL remoteUrl, Capabilities capabilities) {
  RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, capabilities);
  driverProperties.registerCapabilities("remote", driver.getCapabilities());
  return driver;
}

代码示例来源:origin: com.github.albfernandez.richfaces/richfaces-build-resources

static boolean isPhantomjs(WebDriver browser) {

    if (browser instanceof PhantomJSDriver) {
      return true;
    }

    if (browser instanceof RemoteWebDriver) {
      Capabilities capabilities = ((RemoteWebDriver) browser).getCapabilities();
      return DesiredCapabilities.phantomjs().getBrowserName().equals(capabilities.getBrowserName());
    }

    return false;
  }
}

代码示例来源:origin: com.github.jjYBdx4IL/github-test-utils

public static void dumpVersion() {
  Capabilities caps = ((RemoteWebDriver) driver).getCapabilities();
  log.info("browser: " + caps.getBrowserName() + " "
      + caps.getVersion() + " (" + caps.getPlatform() + ")");
}

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

private static boolean isAndroidDriver(Object instance) {
  if (instance instanceof GrapheneProxyInstance) {
    return isAndroidDriver(((GrapheneProxyInstance) instance).unwrap());
  }
  // AndroidDriver is RemoteWebDriver
  if (instance instanceof RemoteWebDriver) {
    Capabilities capabilities = ((RemoteWebDriver) instance).getCapabilities();
    return "android".equals(capabilities.getBrowserName());
  }
  return false;
}

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

private static boolean isAndroidDriver(Object instance) {
  if (instance instanceof GrapheneProxyInstance) {
    return isAndroidDriver(((GrapheneProxyInstance) instance).unwrap());
  }
  // AndroidDriver is RemoteWebDriver
  if (instance instanceof RemoteWebDriver) {
    Capabilities capabilities = ((RemoteWebDriver) instance).getCapabilities();
    return "android".equals(capabilities.getBrowserName());
  }
  return false;
}

代码示例来源:origin: cz.etnetera/seb

@Override
public void afterDriverConstruct(AfterDriverConstructEvent event) {
  WebDriver driver = event.getSeb().getWrappedDriver();
  String driverStr = driver.toString();
  if (driver instanceof RemoteWebDriver) {
    driverStr += " " + ((RemoteWebDriver) driver).getCapabilities();
  }
  seb.log(Level.INFO, "Driver created " + driverStr);
}

代码示例来源:origin: webrtc/KITE

public Tester(WebDriver webDriver) {
 this.webDriver = webDriver;
 Capabilities capabilities = ((RemoteWebDriver) this.webDriver).getCapabilities();
 this.browser =
   capabilities.getBrowserName()
     + "_"
     + capabilities.getVersion()
     + "_"
     + capabilities.getPlatform();
}

代码示例来源:origin: webrtc/KITE

public Tester(WebDriver webDriver) {
 this.webDriver = webDriver;
 Capabilities capabilities = ((RemoteWebDriver) this.webDriver).getCapabilities();
 this.browser =
   capabilities.getBrowserName()
     + "_"
     + capabilities.getVersion()
     + "_"
     + capabilities.getPlatform();
}

代码示例来源:origin: webrtc/KITE

public Tester(WebDriver webDriver) {
 this.webDriver = webDriver;
 Capabilities capabilities = ((RemoteWebDriver) this.webDriver).getCapabilities();
 this.browser =
   capabilities.getBrowserName()
     + "_"
     + capabilities.getVersion()
     + "_"
     + capabilities.getPlatform();
}

代码示例来源:origin: webrtc/KITE

public Tester(WebDriver webDriver){
 this.webDriver = webDriver;
 Capabilities capabilities = ((RemoteWebDriver) this.webDriver).getCapabilities();
 this.browser = capabilities.getBrowserName() + "_" + capabilities.getVersion() +"_" + capabilities.getPlatform();
}

代码示例来源:origin: webrtc/KITE

public Tester(WebDriver webDriver) {
 this.webDriver = webDriver;
 Capabilities capabilities = ((RemoteWebDriver) this.webDriver).getCapabilities();
 this.browser =
   capabilities.getBrowserName()
     + "_"
     + capabilities.getVersion()
     + "_"
     + capabilities.getPlatform();
}

代码示例来源:origin: webrtc/KITE

public Tester(WebDriver webDriver) {
 this.webDriver = webDriver;
 Capabilities capabilities = ((RemoteWebDriver) this.webDriver).getCapabilities();
 this.browser =
   capabilities.getBrowserName()
     + "_"
     + capabilities.getVersion()
     + "_"
     + capabilities.getPlatform();
}

相关文章