简体   繁体   English

如何在用户模式下打开 Selenium 浏览器,而不是在机器人 window

[英]How to open Selenium Browser in User mode, not in robotic window

I have written selenium code and it opens Firefox browser, but the browser it opens appears to be similar in behaviour to a private window, ie, it does not load user login sessions from the normal Firefox browser, neither does it store sessions once closed.我写了 selenium 代码,它打开 Firefox 浏览器,但它打开的浏览器在行为上似乎与私有 window 相似,即它不会从普通的 Firefox 浏览器加载用户登录会话,一旦关闭它也不存储会话。 I want to open selenium as if it was operated by a human, in the original Firefox, that does not contain the icon:我想像人操作一样打开selenium,在原来的Firefox中,不包含图标: 在此处输入图像描述

TIA TIA

To get your User-Profile see:要获取您的用户配置文件,请参阅:

Now you can add Options to your WebDriver.现在您可以将选项添加到您的 WebDriver。

from selenium.webdriver.firefox.options import Options as FirefoxOptions

options = FirefoxOptions()
options.add_argument('--user-data-dir=/path/to/my/profile')
driver = webdriver.Firefox(options=options)

This should load the previous saved User-Profile.这应该加载以前保存的用户配置文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM