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

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

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

RemoteWebDriver.<init>介绍

暂无

代码示例

代码示例来源:origin: galenframework/galen

@Override
public Browser openBrowser() {
  
  try {
    
    WebDriver driver = new RemoteWebDriver(new URL(gridUrl), this.createCapabilities());
    WebDriver augmentedDriver = new Augmenter().augment(driver);
    return new SeleniumBrowser(augmentedDriver);
  }
  catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}

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

@Override
protected void containerIsStarted(InspectContainerResponse containerInfo) {
  driver = Unreliables.retryUntilSuccess(30, TimeUnit.SECONDS,
      Timeouts.getWithTimeout(10, TimeUnit.SECONDS,
          () ->
            () -> new RemoteWebDriver(getSeleniumAddress(), capabilities)));
  if (vncRecordingContainer != null) {
    LOGGER.debug("Starting VNC recording");
    vncRecordingContainer.start();
  }
}

代码示例来源:origin: code4craft/webmagic

mDriver = new RemoteWebDriver(new URL(driver), sCaps);
} else if (driver.equals(DRIVER_FIREFOX)) {
  mDriver = new FirefoxDriver(sCaps);

代码示例来源:origin: selenide/selenide

private WebDriver createRemoteDriver(Config config, Proxy proxy) {
 try {
  DesiredCapabilities capabilities = getDriverCapabilities(config, new Browser(config.browser(), false), proxy);
  RemoteWebDriver webDriver = new RemoteWebDriver(new URL(config.remote()), capabilities);
  webDriver.setFileDetector(new LocalFileDetector());
  return webDriver;
 } catch (MalformedURLException e) {
  throw new IllegalArgumentException("Invalid 'remote' parameter: " + config.remote(), e);
 }
}

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

WebDriver driver = new RemoteWebDriver( ... );
driver           = new Augmenter().augment( driver );
( (TakesScreenshot)driver ).getScreenshotAs( ... );

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

private static RemoteWebDriver getRemoteDriver(String host, int port, Capabilities options) throws Exception {
  int attempts = 30;
  URL hubUrl = new URL(String.format("http://%s:%s/wd/hub", host, port));
  for (int i = 0; i < attempts; i++) {
    if (pingHost(host, port, 500) && isReachable(hubUrl)) {
      return new RemoteWebDriver(hubUrl, options);
    }
    Thread.sleep(1000);
  }
  throw new IllegalStateException("Selenium webdriver cannot connect to selenium container");
}

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

static CheckedSupplier<WebDriver> remoteWebDriverInstance(DesiredCapabilities desiredCapability,
                             final String ip) {
 return () -> {
  Logger.getLogger(BrowserDriverFunctions.class).info("Create RemoteWebdriver to " + ip + " for browser: " + desiredCapability);
  final URL url = new URL(ip);
  return new RemoteWebDriver(url, desiredCapability);
 };
}

代码示例来源:origin: org.mazarineblue/MazarineBlue-WebDriver-keywords

private WebDriver createRemote(String url, String profile) {
  try {
    Capabilities capabilities = profiles.containsKey(profile)
        ? profiles.get(profile)
        : factory.createCapabilities(profile);
    return new RemoteWebDriver(new URL(url), capabilities);
  } catch (UnsupportedProfileException ex) {
    throw new BrowserUnsupported(profile, ex);
  } catch (java.net.MalformedURLException ex) {
    throw new MalformedURLException(url, ex);
  }
}

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

private WebDriver createGridWebDriver() throws MalformedURLException {
  URL hubUrl = new URL(TestParameters.SELENIUM_HUB_URL);
  DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
  desiredCapabilities.setCapability(BROWSER_NAME, TestParameters.BROWSER);
  return new RemoteWebDriver(hubUrl, desiredCapabilities);
}

代码示例来源:origin: org.arquillian.cube/arquillian-cube-docker-drone

@Override
public RemoteWebDriver createInstance(WebDriverConfiguration webDriverConfiguration) {
  RemoteWebDriver remoteWebDriver = new RemoteWebDriver(createSeleniumUrl(), getDesiredCapabilities());
  return remoteWebDriver;
}

代码示例来源: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.galenframework/galen-core

@Override
public Browser openBrowser() {
  
  try {
    
    WebDriver driver = new RemoteWebDriver(new URL(gridUrl), this.createCapabilities());
    WebDriver augmentedDriver = new Augmenter().augment(driver);
    return new SeleniumBrowser(augmentedDriver);
  }
  catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}

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

public WebDriver newDriver(Capabilities capabilities) throws IOException {
  try {
    logger.debug("Creating new driver instance with capabilities: {}", capabilities);
    return new RemoteWebDriver(getDriverService().getUrl(), capabilities);
  } catch (WebDriverException couldNotReachDriverService) {
    logger.warn("Remote driver creation failed ({}), falling back on default driver creation", couldNotReachDriverService.getMessage().split("\n")[0]);
    return newDriverInstance(capabilities);
  }
}

代码示例来源:origin: kg.apc/jmeter-plugins-webdriver

@Override
protected RemoteWebDriver createBrowser() {
  try {
    RemoteWebDriver driver = new RemoteWebDriver(new URL(getSeleniumGridUrl()), createCapabilities());
    driver.setFileDetector(createFileDetector());
    LOGGER.debug("Created web driver with " + createFileDetector().getClass().getName());
    return driver;
  } catch (MalformedURLException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.synaptix.redpepper/redpepper-automation

public RemoteWebDriver getRemoteDriver(boolean canTakeScreenShots) throws MalformedURLException {
  RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), DesiredCapabilities.firefox());
  driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  // if(canTakeScreenShots){
  // WebDriver augmentedDriver = new Augmenter().augment(driver);
  // File screenshot = ((TakesScreenshot) augmentedDriver).getScreenshotAs(OutputType.FILE);
  // }
  return driver;
}

代码示例来源:origin: Cognifide/aet

private WebDriver getChromeDriver(DesiredCapabilities capabilities)
  throws MalformedURLException {
 WebDriver driver =
   StringUtils.isNotBlank(config.seleniumGridUrl()) ?
     new RemoteWebDriver(new URL(config.seleniumGridUrl()), capabilities)
     : new ChromeDriver(capabilities);
 driver.manage().timeouts().pageLoadTimeout(5L, TimeUnit.MINUTES);
 return driver;
}

代码示例来源:origin: io.github.aktoluna/slnarch-core

@Override
 public RemoteWebDriver buildWebDriver(DesiredCapabilities options, Proxy proxy)
   throws MalformedURLException {
  return setTimeOut(new RemoteWebDriver(new URL(
    StringHelper.isEmpty(configuration.getHubUrl()) ? LOCAL_URL : configuration.getHubUrl()),
    getOptions(options, proxy)));
 }
}

代码示例来源:origin: io.github.aktoluna/slnarch-core

@Override
 public RemoteWebDriver buildWebDriver(DesiredCapabilities options, Proxy proxy)
   throws MalformedURLException {
  return setTimeOut(new RemoteWebDriver(new URL(
    StringHelper.isEmpty(configuration.getHubUrl()) ? TESTINIUM_URL
      : configuration.getHubUrl()), getOptions(options, proxy)));
 }
}

代码示例来源:origin: com.github.webdriverextensions/webdriverextensions

private WebDriver createDriver(URL url) throws Exception {
  DesiredCapabilities finalDesiredCapabilities = new DesiredCapabilities(desiredCapabilities);
  finalDesiredCapabilities.setBrowserName(browserName);
  finalDesiredCapabilities.setVersion(version);
  finalDesiredCapabilities.setCapability(PLATFORM, platform);
  return new RemoteWebDriver(
      url,
      finalDesiredCapabilities);
}

代码示例来源:origin: mirkosertic/Bytecoder

private WebDriver newDriverForTest() {
  final ChromeOptions theOptions = new ChromeOptions().setHeadless(true);
  theOptions.addArguments("--js-flags=experimental-wasm-eh");
  theOptions.addArguments("--enable-experimental-wasm-eh");
  final LoggingPreferences theLoggingPreferences = new LoggingPreferences();
  theLoggingPreferences.enable(LogType.BROWSER, Level.ALL);
  theOptions.setCapability(CapabilityType.LOGGING_PREFS, theLoggingPreferences);
  final DesiredCapabilities theCapabilities = DesiredCapabilities.chrome();
  theCapabilities.setCapability(ChromeOptions.CAPABILITY, theOptions);
  return new RemoteWebDriver(DRIVERSERVICE.getUrl(), theCapabilities);
}

相关文章