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位置,根据你自己的情况而定!

● 成功:

● 项目背景:

相关推荐
IT小白杨5 小时前
工程视角下的浏览器环境API:资源模型、权限审计与MCP实践
大数据·经验分享·selenium·chrome devtools·安全架构·指纹浏览器
随风而飘1865 小时前
KEITHLEY吉时利 2400 数字源表
人工智能·功能测试·科技·测试工具
程序员三藏10 小时前
自动化测试用例编写详解
自动化测试·软件测试·python·功能测试·测试工具·职场和发展·测试用例
测试老哥13 小时前
Pytest自动化测试框架tep环境变量、fixtures、用例三者之间的关系
自动化测试·软件测试·python·测试工具·测试用例·pytest·职场发展
IT小白杨14 小时前
当MCP遇上指纹浏览器:AI自然语言驱动隔离环境的实践思路
人工智能·经验分享·selenium·安全·业界资讯·指纹浏览器
qq_5137280415 小时前
Selenium 显式等待
selenium·测试工具
St_rive16 小时前
selenium cookie的处理
数据库·selenium·测试工具
随风而飘18617 小时前
安立(Anritsu)MT8820C无线综合测试仪(手机综测仪)
网络·功能测试·测试工具·5g·智能手机
m24tyy1 天前
常见空间测绘搜索引擎介绍和使用以及子域名的收集
网络·测试工具·搜索引擎