N. Doe
N. Doe

Reputation: 75

Chrome from selenium won't sync

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.

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).

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?

Upvotes: 0

Views: 2495

Answers (1)

N. Doe
N. Doe

Reputation: 75

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']) 

and then I enabled it like so:

options.add_argument('--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.

Upvotes: 2

Related Questions