英文:
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("--user-data-dir=C:\\Users\\<USER>\\AppData\\Local\\Microsoft\\Edge\\User Data");
to the options arguments followed by
options.addArguments("--profile-directory=Default");
But has anyone solved it for MacOS? Could not find a User Data
folder under /Users/<USER>/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/<USER>/Library/Application support/Microsoft Edge/Profile 1
, your options
should look like:
options.addArguments("--user-data-dir=\\Users\\<USER>\\Library\\Application support\\Microsoft Edge");
options.addArguments("--profile-directory=Profile 1");
Additionally, it looks like you have BrowserSignin configured among your group policies. It would be easier to not configure this policy if possible.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论