I found a pretty simple way to do it for Chrome and Firefox using the Google Analytics Opt out Add ons, which are maintained for basically all browser. Refering to this SO question about browser plugin testing with selenium, I was able to open a GA/free session with the following code for C#

var options = new ChromeOptions();
options.Proxy = proxy;
options.AddExtension(Path.GetFullPath("chrome-ga-optout-extension.crx"));
var driver = new ChromeDriver(options);

and

var profile = new FirefoxProfile();
profile.AddExtension(Path.GetFullPath("firefox-ga-optou-addon.xpi"));
profile.SetProxyPreferences(proxy);
var driver = new FirefoxDriver(profile);

after copying the extension/addon to working directory. Chrome extension .crx files can be downloaded using the help of this SO post.

Unfortunately with this approach for IE, we are at the mercy of Selenium implementing add on support for IE Driver, which is probably a hopeless case…. If anyone can think of a solution for IE, that would be amazing.



Source link https://sqa.stackexchange.com/questions/6859/how-do-you--google--from-selenium--

LEAVE A REPLY

Please enter your comment!
Please enter your name here