Selenium - 启动后报org.openqa.selenium.InvalidArgumentException: invalid argument错

● 出现的异常:

复制代码
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'DESKTOP-H7TOMMO', ip: '192.168.64.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
	at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:100)
	at java.util.Optional.orElseGet(Unknown Source)
	at org.openqa.selenium.firefox.FirefoxOptions.getBinary(FirefoxOptions.java:216)
	at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:187)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
	at test.main(test.java:13)
  • 原因:firebox浏览器没有安装在默认的路径
  • 解决方案:

图中12、13行代码为火狐浏览器位置和geckodriver位置,根据你自己的情况而定!

● 成功:

● 项目背景:

相关推荐
Bellafu6661 小时前
selenium常用的等待有哪些?
python·selenium·测试工具
Bellafu6664 小时前
selenium定位元素失败,常见错误有哪些?
selenium·测试工具
傻啦嘿哟10 小时前
用Selenium模拟登录淘宝并采集商品信息:从基础到实战
selenium·测试工具
起个破名想半天了13 小时前
五秒盾解决方案之Selenium
selenium·cloudflare·反爬
robinspada13 小时前
用mitmproxy替代selenium-wire
selenium·测试工具·mitmproxy·selenium-wire
我的xiaodoujiao13 小时前
从 0 到 1 搭建完整 Python 语言 Web UI自动化测试学习系列 17--测试框架Pytest基础 1--介绍使用
python·学习·测试工具·pytest
Bellafu66613 小时前
selenium的css定位方式有哪些
css·selenium·tensorflow
Bellafu66613 小时前
selenium对每种前端控件的操作,python举例
前端·python·selenium
Bellafu66613 小时前
下载selenium-ide及使用
ide·selenium·测试工具
将车24413 小时前
自动化测试脚本环境搭建
python·测试工具·自动化