在 XP 上启动 Selenium 时出现以下错误
java.lang.RuntimeException:
Could not start Selenium session: Failed to start new browser session:
java.lang.RuntimeException: java.io.FileNotFoundException:
C:\Program Files\Mozilla Firefox (Access is denied)
有什么想法吗?
最佳答案
有点明显,但看起来 Selenium 正在尝试读取/写入 Firefox 配置文件,但系统阻止了它。这可能是因为 Selenium 用户没有适当的安全权限,或者可能是其他原因锁定了对配置文件的访问。
您可以尝试运行 Sysinternals Process Explorer识别阻碍因素的工具。
Firefox 可以在复制过程中阻止对 Selenium 配置文件的访问,就像 mentioned in this related answer 一样。 。
您可能还想refer to the Selenium documentation关于配置文件处理:
Firefox will not run two instances simultaneously unless you specify a separate profile for each instance. Selenium-RC 1.0 and later runs in a separate profile automatically, so if you are using Selenium 1.0, you can probably skip this section. However, if you’re using an older version of Selenium or if you need to use a specific profile for your tests (such as adding an https certificate or having some addons installed), you will need to explicitly specify the profile.
关于java - Selenium - 无法启动浏览器 session - 访问被拒绝 - XP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4466168/