本文介绍了硒中的Chrome无法同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试打开一个启用了同步选项的硒浏览器.我要么指定--used-data-dir(将我的Google帐户中的所有cookie和扩展名加载到硒中),要么不指定,它仍然不允许我同步.检查浏览器是否允许同步的一种方法是转到设置->人员.如果浏览器正在同步,则您的帐户名下必须存在同步于标签/选项.如果浏览器未同步,则此选项不存在,因此您无法更改它.

I am trying to open up a selenium browser with sync option enabled. Either I specify --used-data-dir (having all the cookies and extensions from my google account loaded on selenium) or I don't, it stills won't allow me to sync. A way to check if the browser is allowed to sync is to go to settings -> people. If the browser is syncing a Sync on label/option must exist under your account name. If the browser is not syncing then this option is not there, and so you cannot change it.

我还尝试了根据,但是硒仍然不会同步(即使在 chrome://policy/中设置了 SyncDisabled 策略为 false ).

I have also tried changing the chrome policy DisableSync globally from the registry edit as specified here, but still, selenium won't sync (even if in chrome://policy/ the SyncDisabled policy is set to false).

将不会同步,例如我在网站上添加/更改密码,新密码不会存储在我帐户的Cookie中,这基本上是我的目标.请澄清一下,当我正常打开Chrome(不是硒)时,当然可以使用sync选项.

Won't sync means that if e.g. I add/change a password from a site, the new password won't be stored in my account's cookies, which is basically my objective. Just to clarify, when I open chrome normally (not selenium) then, of course, the sync option is available.

所以,我想问的问题是启用同步选项后如何通过硒打开铬?

So, my question I guess is how I can open chrome through selenium having the sync option enabled?

推荐答案

我终于找到了解决方案.因此,当您通过硒启动chrome时,即使您未指定-disable-sync 参数,它也会自行指定.换句话说,在命令行列表上的新生成的硒浏览器中访问 chrome://version ,会有一个--disable-sync参数.所以基本上我首先像这样排除它:

I finally found a solution. So when you start chrome through selenium, even if you are not specifying the --disable-sync argument, it specifies it itself. In other words, visiting chrome://version in a newly generated selenium browser on the list of command lines there is the --disable-sync argument. So basically I first excluded it like so:

options.add_experimental_option(
    'excludeSwitches',
    ['disable-sync']) 

然后我像这样启用它:

options.add_argument('--enable-sync')

由于如果未在启用它之前将其排除,则--disable-sync--enable-sync都将在命令行列表中.

since if didn't excluded it before enabling it, both the --disable-sync and the --enable-sync would be in the command lines list.

这篇关于硒中的Chrome无法同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!