如何解决您的Firefox个人资料无法加载。它可能缺少或无法访问”在使用硒的同时

发布于 2025-02-04 13:54:04 字数 1103 浏览 5 评论 0原文

我想将硒与geckodriver一起使用。因此,我已经安装了Firefox和Geckodriver。但是,当我只运行一个简单的硒应用程序时,我会得到一个带有错误的对话框。

我的代码:

 public static void main(String[] args) throws MalformedURLException {

     System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");

     WebDriver driver2 = new FirefoxDriver();
     driver2.get("https://google.com");

硒日志:

Mozrunner :: Runner Info Running命令:“/usr/bin/firefox“ - marionette” - marionette“” - no-remote“ - profile”“/tmp/tmp/rust_mozprofilebf85lf”

线程“ main” org.openqa.selenium.webdriverexception中的例外: 过程出乎意料地关闭了状态1构建信息:版本: '3.141.5',修订:'D54EBD709A',时间:'2018-11-06T11:42:16'系统 信息:主机:'my-thinkpad',ip:'192.168.100.117',os.name:'linux','linux', os.ark:'amd64',os.version:'5.15.0-33代',java.version: '13 .0.2'驱动程序信息:驱动程序。version:firefoxdriver

但我作为对话框的主要问题:

无法加载您的Firefox配置文件。它可能丢失或 无法访问。

当我刚刚在终端中运行/usr/bin/firefox ...命令而没有配置文件参数。我从几个教程中获得了提示,以删除我的主目录中的.Mozilla目录,但是没有.Mozilla文件夹。我正在使用Kubuntu 22.04。有什么方法可以在没有配置文件参数的情况下启动geckodriver或解决此问题?

I want to use selenium with geckodriver. So I have installed firefox and Geckodriver. But when I just run a simple selenium Application I get a dialoge box with the error.

My Code:

 public static void main(String[] args) throws MalformedURLException {

     System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");

     WebDriver driver2 = new FirefoxDriver();
     driver2.get("https://google.com");

Selenium Log:

mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "-no-remote" "-profile" "/tmp/rust_mozprofileBF85Lf"

Exception in thread "main" org.openqa.selenium.WebDriverException:
Process unexpectedly closed with status 1 Build info: version:
'3.141.5', revision: 'd54ebd709a', time: '2018-11-06T11:42:16' System
info: host: 'my-thinkpad', ip: '192.168.100.117', os.name: 'Linux',
os.arch: 'amd64', os.version: '5.15.0-33-generic', java.version:
'13.0.2' Driver info: driver.version: FirefoxDriver

But the main Problem I get as dialogbox:

Your Firefox profile cannot be loaded. It may be missing or
inaccessible.

When I just run the /usr/bin/firefox ... command in terminal without the profile parameter it works. I got the tip from several tutorials to delete the .mozilla directory in my home directory, but there is no .mozilla folder. Im using Kubuntu 22.04. Is there any way to start geckodriver without profile parameter or solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撞了怀 2025-02-11 13:54:04

资料可能存储在没有权限的目录中。因此,显然会失败。

解决方案:

  1. enter 导出tmpdir = $ home/downloads/geckodriver

在我的情况下,我的geckodriver in 下载>下载,所以我将TMPDIR导出到下载

或尝试以下操作:

只需将geckodriver移动到有权写入下载文档的任何其他目录中,然后尝试以上解决方案。

Probably the profile gets stored in the directory where there is no permission to write. So, it would obviously fail.

Solution:

  1. enter export TMPDIR=$HOME/Downloads/ geckodriver

In my case, my geckodriver is in Downloads so I exported TMPDIR to the Downloads.

Or try this:

Just move the geckodriver to any other directory where there is permission to write like Downloads or Documents and try the above solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文