类org.openqa.selenium.os.ExecutableFinder源码实例Demo

下面列出了怎么用org.openqa.selenium.os.ExecutableFinder的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: marathonv5   文件: BrowserTab.java
protected void addWebDriverExeBrowse() {
    String value = BrowserConfig.instance().getValue(getBrowserName(), "webdriver-exe-path");
    String def = new ExecutableFinder().find(getWebDriverExecutableName());
    wdExeField = new TextField();
    if (def != null)
        wdExeField.setPromptText(def);
    if (value != null)
        wdExeField.setText(value);
    browseWDExeButton = FXUIUtils.createButton("browse", "Browse WebDriver Executable", true, "Browse");
    FileSelectionHandler fileSelectionHandler = new FileSelectionHandler(this, null, null, browseWDExeButton,
            "Select WebDriver executable");
    fileSelectionHandler.setMode(FileSelectionHandler.FILE_CHOOSER);
    browseWDExeButton.setOnAction(fileSelectionHandler);

    basicPane.addFormField("WebDriver Executable:", wdExeField, browseWDExeButton);
}
 
源代码2 项目: selenium   文件: DriverService.java
/**
 *
 * @param exeName Name of the executable file to look for in PATH
 * @param exeProperty Name of a system property that specifies the path to the executable file
 * @param exeDocs The link to the driver documentation page
 * @param exeDownload The link to the driver download page
 *
 * @return The driver executable as a {@link File} object
 * @throws IllegalStateException If the executable not found or cannot be executed
 */
protected static File findExecutable(
    String exeName,
    String exeProperty,
    String exeDocs,
    String exeDownload) {
  String defaultPath = new ExecutableFinder().find(exeName);
  String exePath = System.getProperty(exeProperty, defaultPath);
  Require.state("The path to the driver executable", exePath).nonNull(
      "The path to the driver executable must be set by the %s system property;"
          + " for more information, see %s. "
          + "The latest version can be downloaded from %s",
          exeProperty, exeDocs, exeDownload);

  File exe = new File(exePath);
  checkExecutable(exe);
  return exe;
}
 
源代码3 项目: selenium   文件: CoreSelfTest.java
@Before
public void detectBrowser() {
  browser = System.getProperty("selenium.browser", "*googlechrome");

  switch (browser) {
    case "*firefox":
      assumeNotNull(new ExecutableFinder().find("geckodriver"));
      break;

    case "*googlechrome":
      assumeNotNull(new ExecutableFinder().find("chromedriver"));
      break;

    default:
      assumeFalse("No known driver able to be found", false);
  }
}
 
源代码4 项目: selenium   文件: MavenPublisher.java
private static Path sign(Path toSign) throws IOException {
  LOG.info("Signing " + toSign);

  // Ideally, we'd use BouncyCastle for this, but for now brute force by assuming
  // the gpg binary is on the path

  String path = new ExecutableFinder().find("gpg");
  if (path == null) {
    throw new IllegalStateException("Unable to find gpg for signing artifacts");
  }

  Path dir = Files.createTempDirectory("maven-sign");
  Path file = dir.resolve(toSign.getFileName() + ".asc");

  CommandLine gpg = new CommandLine(
      "gpg", "--use-agent", "--armor", "--detach-sign", "--no-tty",
      "-o", file.toAbsolutePath().toString(), toSign.toAbsolutePath().toString());
  gpg.execute();
  if (!gpg.isSuccessful()) {
    throw new IllegalStateException("Unable to sign: " + toSign + "\n" + gpg.getStdOut());
  }

  // Verify the signature
  CommandLine verify = new CommandLine(
    "gpg", "--verify", "--verbose", "--verbose",
    file.toAbsolutePath().toString(), toSign.toAbsolutePath().toString());
  verify.execute();
  if (!verify.isSuccessful()) {
    throw new IllegalStateException("Unable to verify signature of " + toSign + "\n" + gpg.getStdOut());
  }

  return file;
}
 
源代码5 项目: java-client   文件: AppiumServiceBuilder.java
private static File findBinary(String name, String errMsg) {
    return validatePath(new ExecutableFinder().find(name), errMsg);
}
 
 类所在包
 类方法
 同包方法