org.openqa.selenium.os.ExecutableFinder Java Examples

The following examples show how to use org.openqa.selenium.os.ExecutableFinder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BrowserTab.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: DriverService.java    From selenium with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @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;
}
 
Example #3
Source File: CoreSelfTest.java    From selenium with Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example #4
Source File: MavenPublisher.java    From selenium with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: AppiumServiceBuilder.java    From java-client with Apache License 2.0 4 votes vote down vote up
private static File findBinary(String name, String errMsg) {
    return validatePath(new ExecutableFinder().find(name), errMsg);
}