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

● 成功:

● 项目背景:

相关推荐
巴里巴气6 小时前
selenium基础知识 和 模拟登录selenium版本
爬虫·python·selenium·爬虫模拟登录
2501_924064119 小时前
2025年跨端云真机测试平台深度测评:XR与折叠屏时代的兼容性之战
测试工具·移动端自动化测试·自动化测试脚本
Small black human18 小时前
HTTP-Postman的安装及其使用
测试工具·postman
AIZHINAN21 小时前
Appium 简介
自动化测试·测试工具·appium
吴free1 天前
mac电脑wireshark快速实现http接口抓包
网络·测试工具·http·wireshark
DeamoTech1 天前
ESCADA
物联网·测试工具
旷世奇才李先生2 天前
Selenium 安装使用教程
selenium·测试工具
巴里巴气2 天前
对selenium进行浏览器和驱动进行配置Windows | Linux
selenium·测试工具
q567315233 天前
Java Selenium反爬虫技术方案
java·爬虫·selenium
有趣的我3 天前
wireshark介绍和使用
网络·测试工具·wireshark