java - Chrome 驱动程序 "The driver is not executable"

标签 java google-chrome selenium selenium-chromedriver

我的 chromedriver 和 chromedriver.exe 就在项目文件夹中。 我正在使用此代码创建驱动程序实例。

ChromeOptions options = new ChromeOptions();
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
LoggingPreferences log_prefs = new LoggingPreferences();
log_prefs.enable(LogType.BROWSER, Level.SEVERE);
capabilities.setCapability(CapabilityType.LOGGING_PREFS, log_prefs);
System.setProperty("webdriver.chrome.driver", "chromedriver");
driver = new ChromeDriver(capabilities);
driver.manage().window().maximize();

它在本地 Windows 上没问题(如果我们将“chromedriver”更改为“chromedriver.exe”),但是当我在 CentOS 上运行它时,我收到错误消息:“驱动程序不可执行”。

最佳答案

使其可执行: 在 CentOs 中使用 chmod +x chromedriver

关于java - Chrome 驱动程序 "The driver is not executable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25720724/

相关文章:

Spring Tool Suite 中的 Java MVC 项目附加文件

java - 生成没有相邻字符的字符串的所有排列的算法

javascript - 谷歌浏览器扩展程序点击打开多个标签

html - 在 chrome 上滚动时 Webkit 掩码移动

selenium - Selenium 网格中的自定义浏览器

java - WebDriver等待,不同的等待条件

java - 这个方法是什么意思?

java - 使用hibernate和tapestry JAVA

node.js - Puppeteer:如何在没有 CSS/JS/fonts/images 的情况下只加载 html?

java - 如何让 Selenium 等到元素出现?