绕过Selenium 4 Java(MacOS)中的Edge Chromium配置登录屏幕

huangapple go评论88阅读模式
英文:

Bypass Edge Chromium profile Sign in screen in Selenium 4 Java(MacOS)

问题

我知道这个问题已经在Windows上得到了解答。每次我尝试使用Selenium 4自动化Edge浏览器时,都会弹出一个选择配置文件的窗口,然后再进行登录。

在Windows上,您需要在选项参数中添加以下内容:

options.addArguments("--user-data-dir=C:\\Users\\<USER>\\AppData\\Local\\Microsoft\\Edge\\User Data");

然后是:

options.addArguments("--profile-directory=Default");

但是有没有人解决了MacOS的问题?我在/Users/<USER>/Library/Application Support/Microsoft Edge/文件夹下找不到User Data文件夹。对我来说,它直接有一个Profile 1文件夹。我尝试了各种排列组合来设置--user-data-dir--profile-directory,但似乎没有任何方法适用于我。

英文:

I know this question has been answered for Windows. Every time I try to automate Edge browser using Selenium 4, I get shown a profile window to select and then to sign in.

In Windows, you need to pass in the options.addArguments(&quot;--user-data-dir=C:\\Users\\&lt;USER&gt;\\AppData\\Local\\Microsoft\\Edge\\User Data&quot;);

to the options arguments followed by

options.addArguments(&quot;--profile-directory=Default&quot;);

But has anyone solved it for MacOS? Could not find a User Data folder under /Users/&lt;USER&gt;/Library/Application support/Microsoft Edge/ folder. It directly has Profile 1 folder for me. I tried various permutations and combinations to set the --user-data-dir and --profile-directory Nothing seems to be working for me.

答案1

得分: 1

翻译内容:

特定路径应该基于您在edge://version中的配置文件路径,与操作系统无关。

例如,如果您前往edge://version,您的配置文件路径/Users/<USER>/Library/Application support/Microsoft Edge/Profile 1,则您的options应该如下所示:

options.addArguments("--user-data-dir=\\Users\\<USER>\\Library\\Application support\\Microsoft Edge");
options.addArguments("--profile-directory=Profile 1");

另外,看起来您已经在您的组策略中配置了BrowserSignin。如果可能的话,最好不要配置这个策略。

英文:

The specific path should be based on your Profile path at edge://version, regardless of OS.

For example, if you go to edge://version, and your Profile path is /Users/&lt;USER&gt;/Library/Application support/Microsoft Edge/Profile 1, your options should look like:

options.addArguments(&quot;--user-data-dir=\\Users\\&lt;USER&gt;\\Library\\Application support\\Microsoft Edge&quot;);
options.addArguments(&quot;--profile-directory=Profile 1&quot;);

Additionally, it looks like you have BrowserSignin configured among your group policies. It would be easier to not configure this policy if possible.

huangapple
  • 本文由 发表于 2023年6月15日 09:55:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76478587.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定