我正在尝试启动Mozilla但仍然遇到此错误

时间:2017-10-11 07:58:57

标签: java selenium selenium-webdriver selenium-rc selenium-grid

我更新鲜的硒,当我改变我的系统时,我收到了这个错误。请为我建议一个解决方案。提前致谢。

Selenium - 3.4.0 Firebox浏览器 - 47.0.2 Geckodriver - geckodriver-v0.16.1-win64

Exception in thread "main" java.lang.IllegalStateException: The driver executable is a directory: C:\Users\User\Downloads\geckodriver-v0.16.1-win64
    at com.google.common.base.Preconditions.checkState(Preconditions.java:518)
    at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:138)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:131)
    at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:41)
    at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:115)
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330)
    at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:207)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:108)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:104)
    at Facebook_listbox.main(Facebook_listbox.java:12)

3 个答案:

答案 0 :(得分:1)

您必须设置网络驱动程序。请尝试以下:

System.setProperty("webdriver.gecko.driver", "Path to .exe");

WebDriver driver = new FirefoxDriver();

driver.get("http://seleniumhq.com");

答案 1 :(得分:0)

您必须在系统属性中设置geckodriver文件:

import path from 'path';
import url from 'url';

let build = gulp.series(
  gulp.parallel(
    replaceIndexCdnUrl,
    replaceSourceCdnUrl,
    replaceCssCdnUrl
  ),
  readProjectConfiguration,
  gulp.parallel(
    transpile,
    processMarkup,
    processCSS,
    copyFiles
  ),
  writeBundles,
  replaceIndexCdnUrl
);

提取文件 geckodriver-v0.16.1-win64.zip 并设置geckodriver.exe的路径。

答案 2 :(得分:0)

您没有正确输入geckdriver的路径。提取为geckodriver下载的文件,并将路径设置为&#34; geckodriver.exe&#34;在提取的文件夹中请参阅此内容。

#include<stdio.h>

void modif(const int *p)
{
  int *q = (int*)p;
  *(q+1)=5;
}

int main()
{
  int a[2] = {0};
  modif(a);
  printf("\n%d, %d",a[0], a[1]);

  return 0;
}