selenium java.lang.IllegalStateException: must be set by the webdriver.gecko.driver

在使用selenium打开Firefox时遇到错误:java.lang.IllegalStateException,原因是Selenium 3.x版本需要设置webdriver.gecko.driver系统属性。解决方案包括下载对应位数的GeckoDriver,并根据Firefox的位数(32位或64位)选择正确版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, seehttps://github.com/mozilla/geckodriver

selenium 打开firefox时报错

原因是使用了最新的selenium webdriver版本Selenium 3.x,此版本不支持直接启动firefox,必须要先设置SystemProperty 

下载最新版本的geckoDriver 

https://github.com/mozilla/geckodriver/releases

如果github官网不能访问,请参考http://blog.youkuaiyun.com/fabbychips/article/details/53488802



Check if Firefox is 32-bit or 64-bit

There are two versions of GeckoDriver for Windows: 32-bit and 64-bit. Based on whether your Firefox is 32-bit or 64-bit, you need to download the corresponding GeckoDriver exe. In this section, you will first check whether your Firefox is 32-bit or 64-bit


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值