Mac OSX - IllegalStateException:驱动程序不可执行: [英] Mac OSX - IllegalStateException: The driver is not executable:

查看:33
本文介绍了Mac OSX - IllegalStateException:驱动程序不可执行:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Mac OSX 的新手.从 git 下载我的 Robotframework(Selenium & Java) 项目并尝试在本地执行代码,其中我收到以下错误.

套件设置失败:IllegalStateException:驱动程序不可执行:/Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx

为了解决这个问题,我遵循了下面的方法,但没有用.

<块引用>

  1. 将 selenium-java 和独立版本从 2.53.1 升级到 3.4.0.
  2. 指定给 Users/roja/automation 的驱动程序路径
  3. Chromedriver 从 2.31 升级到 2.33
  4. 即使在上述例外中指定的路径中也更新了相同的驱动程序版本.

我也不确定为什么路径默认为 /Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx.

我的git项目保存在路径usr/local/git/testautomation中,chromedriver也保存在同一个路径下.请澄清并为我提供解决方案.

下面为启动浏览器而编写的代码,

public void LaunchBrowser() 抛出 InterruptedException {System.setProperty("Webdriver.chrome.driver", "/Users/roja/Automation/chromedriver_osx");驱动程序 = 新的 ChromeDriver();driver.manage().window().maximize();}

解决方案

快速安装最新的ChromeDriver

要安装最新版本的 ChromeDriver:

  • 使用 Homebrew 的 Mac 用户:

    brew tap homebrew/cask &&brew cask 安装 chromedriver


原始回答于 2017 年 11 月 15 日 12:04

错误 IllegalStateException: The driver is not executable:/Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx 说明了一切.您必须准确地进行 4 处更改,如下所示:

  • Webdriver.chrome.driver 更改为:

    webdriver.chrome.driver

  • 更改/Users/roja/Automation/chromedriver_osx,因为我们需要包含webdriver binary 的名称,即chromedriver 作为 value :

    /Users/roja/Automation/chromedriver_osx/chromedriver

  • driver = new ChromeDriver(); 更改为:

    WebDriver driver = new ChromeDriver();

  • 删除不需要的 throws InterruptedException 以保持您的代码简短.

Im new to Mac OSX. Downloaded my Robotframework(Selenium & Java) project from git and tried to execute the code locally wherein I received the below error.

Suite setup failed: IllegalStateException: The driver is not executable: /Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx

To rectify this issue, I followed the below but it didnt work.

  1. Upgraded the selenium-java and standalone version from 2.53.1 to 3.4.0.
  2. Driver path specified to Users/roja/automation
  3. Chromedriver upgraded from 2.31 to 2.33
  4. And the same driver version updated even in the path specified in the exception above.

Also Im unsure why the path is defaulted to /Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx.

My git projects are saved in the path usr/local/git/testautomation and chromedriver also saved in the same. please clarify and provide me a solution.

Below code written for launching the browser,

public void LaunchBrowser() throws InterruptedException {
System.setProperty("Webdriver.chrome.driver", "/Users/roja/Automation/chromedriver_osx");
driver = new ChromeDriver();
driver.manage().window().maximize();
}

解决方案

Quick installation of the latest ChromeDriver

To install the latest version of ChromeDriver:

  • Mac users with Homebrew:

    brew tap homebrew/cask && brew cask install chromedriver
    


Original answered Nov 15 '17 at 12:04

The error IllegalStateException: The driver is not executable: /Users/roja/Documents/GitHub/testautomation/chromedrivers/chromedriver_osx says it all. You have to make exactly 4 changes as follows :

  • Change Webdriver.chrome.driver as :

    webdriver.chrome.driver
    

  • Change /Users/roja/Automation/chromedriver_osx as we need to include the name of the webdriver binary i.e. chromedriver as a value :

    /Users/roja/Automation/chromedriver_osx/chromedriver
    

  • Change driver = new ChromeDriver(); as :

    WebDriver driver = new ChromeDriver();
    

  • Remove unwanted throws InterruptedException to keep your code short and simple.

这篇关于Mac OSX - IllegalStateException:驱动程序不可执行:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆