解决selenium webdriver运行出现的org.openqa.selenium.firefox.NotConnectedException问题

          第一次用selenium webdriver,当根据教程完成selenium+eclipse等的安装配置后,写了简单的脚本运行的时候出现org.openqa.selenium.firefox.NotConnectedException:Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:的错误,

网上查找资料发现是selenium版本与火狐浏览器的版本有对应关系,查看selenium某一版本对应的火狐浏览器的版本可以在selenium下载页面 http://www.seleniumhq.org/download/ (需FQ) 各个版本的changelog中,会记录支持的firefox版本,查看即可

但是selenium的官网经常打不开,我们可以通过下载的jar包查看,(以selenium-server-standalone-2.50.1.jar为例)使用WINRAR打开selenium-server-standalone-2.50.1.jar>org>openqa>selenium>firefox>webdriver.xpi>右键点击install.rdf文件,选择查看文件,打开的为XML文件,在Firefox的注释下可查看对Firefox版本的要求,该文件的内容如下(版本要求已用加粗下划线标注):

<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">

    <Description about="urn:mozilla:install-manifest">
        <em:id>fxdriver@googlecode.com</em:id>
        <em:version>2.50.1</em:version>
        <em:type>2</em:type>
        <em:name>Firefox WebDriver</em:name>
        <em:description>WebDriver implementation for Firefox</em:description>
        <em:creator>Simon Stewart</em:creator>
        <em:unpack>true</em:unpack>

        <!-- Firefox -->
        <em:targetApplication>
            <Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>3.0</em:minVersion>
                <em:maxVersion>45.0</em:maxVersion>

            </Description>
        </em:targetApplication>

        <em:targetPlatform>Darwin</em:targetPlatform>
        <em:targetPlatform>SunOS</em:targetPlatform>
        <em:targetPlatform>FreeBSD</em:targetPlatform>
        <em:targetPlatform>OpenBSD</em:targetPlatform>
        <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform>
        <em:targetPlatform>Linux</em:targetPlatform>

        <!-- We're probably missing lots of platforms here -->
    </Description>

</RDF>


可以看出该2.50.1版本最小需要火狐浏览器3.0,最高需要45.0,根据要求下载合适的浏览器即可。


一下是chrome浏览器与Firefox以及selenium各个版本的下载地址,希望小伙伴们能少走一些弯路!

chrome:

 

http://google-chrome.en.uptodown.com/mac/old

 

 

Firefox:

 

http://ftp.mozilla.org/pub/firefox/releases/

 

 

selenium:

 

http://selenium-release.storage.googleapis.com/index.html





  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值