How can I enable variations in Chrome from chromedriver options?



  • How can I enable variations in Chrome from chromedriver options?

    Hello, I'm facing a problem with Chrome where when I run an automated UI test with chromedriver, there's issues showing up (such as header is too high which covers other elements) but if I manually open up Chrome and perform the UI tests manually, the issues aren't there (the header looks correct).

    I opened up chrome://version for both browsers and saw that the instance from automation does not have Variations listed, while the manual run had Variations listed.

    I tried adding options.addArgument("--reset-variation-state) in hopes that it would enable it but it did not do anything.

    I'll attach some screenshots Chrome with Variations

    This is chrome without Variations Chrome without Variations



  • So, this kinda worked for me. Currently researching better options.

    If you go into C:\users[username]\AppData\local\Google\Chrome\User Data and find your "Local State" file, there are two entries in there you should see values for -- "variations_compressed_seed" and "variations_seed_signature"

    If you copy those values, and add them in your Chrome options before you start ChromeDriver, then variations should be enabled:

    chromeOptions.AddLocalStatePreference("variations_compressed_seed", "[your compressed seed]");
    chromeOptions.AddLocalStatePreference("variations_seed_signature", "[your seed signature]");
    

    If you don't have those values in your Local State file, you can start Chrome with some dummy data directory, e.g. start > run > chrome.exe --user-data-dir C:/Chrome, then shut down chrome, go to C:\Chrome\ and find the seed and signature in the "Local State" file that gets created in there.



Suggested Topics