51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1388|回复: 1
打印 上一主题 下一主题

ruby+selenium+linux+firefox 下不能调起firefox,解决办法

[复制链接]
  • TA的每日心情
    奋斗
    2016-1-7 23:17
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    跳转到指定楼层
    1#
    发表于 2016-11-20 18:20:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    今天配置ruby+selenium+linux+firefox 环境,selenium-webdriver 安装成功了,然后用ruby 语言写了个很简单的脚本,就是调用firefox浏览器。可是脚本在运行过程中,一直提示:
    /usr/local/share/gems/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/firefox.rb:58:in `driver_path':         Unable to find Mozilla geckodriver. Please download the server from        https://github.com/mozilla/geckodriver/releases and place it        somewhere on your PATH. More info at https://developer.mozilla.org/en ... rionette/WebDriver. (Selenium::WebDriver::Error::WebDriverError)
            from /usr/local/share/gems/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/firefox/w3c_bridge.rb:30:in `initialize'
            from /usr/local/share/gems/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/common/driver.rb:52:in `new'
            from /usr/local/share/gems/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/common/driver.rb:52:in `for'
            from /usr/local/share/gems/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver.rb:82:in `for'
    这样的错误,不能调起firefox浏览器。
    分析问题:
    1、Please download the server from        https://github.com/mozilla/geckodriver/releases and place it     这句话,意思是说 geckodriver  没有下载或下载了没有放到正确的位置。
    于是,我就取下载geckodriver,下载后,发现,无论我把这个文件放任何位置,这个错误还是一直出现。
    2、More info at https://developer.mozilla.org/en ... rionette/WebDriver.   这句话说,想获得更多信息,可以去访问这个地址。
    于是,我就去访问这个地址,看到里面
    Add executable to system path
    The Selenium client bindings will try to locate the geckodriver executable from the system path. You will need to add the directory containing the executable to the system path.
    而且还有个例子,于是,我在我当前系统登录用户下,打开.bashrc文件,把例句复制到里面。
    再次执行脚本。ok,问题解决。
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2024-5-16 12:02
  • 签到天数: 1181 天

    连续签到: 1 天

    [LV.10]测试总司令

    2#
    发表于 2016-11-21 00:13:09 | 只看该作者
    selenium2中集成了FF浏览器的driver,其他的浏览器需要下载相应的driver;
    而selenium3.0的版本,FF浏览器的driver也需要独立下载了,且需要配置path路径。相关的信息可以再官网了解。

    评分

    参与人数 1测试积点 +10 收起 理由
    lsekfe + 10 积极回复获得测试积点10

    查看全部评分

    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-20 16:44 , Processed in 0.065229 second(s), 25 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表