selenium学习笔记(一)

初学selenium,遇到的问题记录下来。

1The path to the driverexecutable must be set by thewebdriver.gecko.driver system property

报这个错,是因为你使用了selenium3+Firefox。在selenium3中,使用Firefox,需要添加驱动。

您可以从Github上下载驱动程序下载网址-  https://github.com/mozilla/geckodriver/releases/tag/v0.9.0

在代码中加入

System.setProperty("webdriver.firefox.marionette","C:\\ProgramFiles (x86)\\Mozilla Firefox\\geckodriver.exe");

WebDriver driver=newFirefoxDriver();

C:\\Program Files(x86)\\Mozilla Firefox\\geckodriver.exe是驱动放置的位置

2、org.openqa.selenium.firefox.NotConnectedException:Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefoxconsole output:extensions\cpmanager@mozillaonline.com.xpi

原因:Firefox版本与Selenium不兼容。

注意:从下面路径能查看Selenium支持的FireFox版本: 

selenium-server-standalone-3.4.0.jar\org\openqa\selenium\firefox\webdriver.xpi\install.rdf

<!-- Firefox -->

<em:targetApplication>

<Description>

<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>

<em:minVersion>3.0</em:minVersion>

<em:maxVersion>48.0</em:maxVersion>

</Description>

</em:targetApplication>

最小支持3.0 最大支持48.0

firefox

版本下载地址http://ftp.mozilla.org/pub/firefox/releases/

seleniumjar

包下载地址http://selenium-release.storage.googleapis.com/index.html



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值