1.报错
Failed to start new browser session: java.lang.RuntimeException: Firefox 3 could not be found in the path!
Please add the directory containing ‘‘firefox.exe‘‘ to your PATH environment.
遇到的原因:firefox没有安装在c盘(本人安装在d盘下),selenium找不到firefox路径。
解决过程:首先尝试将firefox.exe的路径放到系统环境变量path中,重新运行,错误依旧。
正确解决办法:在调用firefox处加上绝对路径(selenium("localhost", 4444, "*firefox D:\\Program Files\\Mozilla Firefox\\firefox.exe", "http://www.baidu.com"))
时间: 2024-10-13 11:51:18