Bar*_*art 5 python cookies selenium google-chrome selenium-chromedriver
我需要在两台计算机之间转移我的Selenium会话。
要通过Selenium导出和导入cookie,您必须分别访问每个网站,然后才能设置其cookie,我想避免这种情况。我也想复制本地存储。
到目前为止,这是我尝试过的方法:
1-启动新的Selenium会话:
driver = webdriver.Chrome()
Run Code Online (Sandbox Code Playgroud)
2-在%temp%中找到其临时Chrome用户配置文件,并将其复制到我的应用程序的文件夹中
3-使用此用户配置文件启动新驱动程序:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("user-data-dir=C:\\profiles\\temp_profile")
driver = webdriver.Chrome(chrome_options=chrome_options)
Run Code Online (Sandbox Code Playgroud)
上面的作品-本地存储和cookie仍在我的本地PC上,但是,当我将此用户配置文件复制到另一台PC并启动它时,本地存储仍然存在,但cookie消失了。
我还使用常规的chrome配置文件尝试了相同的操作,并尝试直接在Chrome中而不是在Selenium中启动用户配置文件,并且cookie仍然消失了。
| 归档时间: |
|
| 查看次数: |
2654 次 |
| 最近记录: |