Browser Plugin Testing With Selenium -



Browser Plugin Testing With Selenium -

i writing webapp has browser plugin component both firefox , chrome. current testing scheme uses series of selenium tests created through selenium ide.

is possible have selenium install, activate, , delete browser plugins firefox , chrome (possibly other browsers well)?

i think biggest concern installing/enabling browser plugin requires browser restart, , i'm not sure if through selenium off.

the acquisition of plugin handled visiting internal site-link php-script detects browser.

the reply yes, selenium 2 supports (remote) installation of browser extensions.

the chrome , firefox webdriver back upwards installation of extensions, remotely. here's sample code chrome , firefox:

chrome class="lang-java prettyprint-override">file file = new file("extension.crx"); // zip files accepted chromeoptions options = new chromeoptions(); options.addextensions(file); // alternative 1: locally. webdriver driver = new chromedriver(options); // alternative 2: remotely desiredcapabilities capabilities = desiredcapabilities.chrome(); capabilities.setcapability(chromeoptions.capability, options); webdriver driver = new remotewebdriver(new url("http://localhost:4444/wd/hub"), capabilities); firefox class="lang-java prettyprint-override">file file = new file("extension.xpi"); firefoxprofile firefoxprofile = new firefoxprofile(); firefoxprofile.addextension(file); // alternative 1: locally webdriver driver = new firefoxdriver(firefoxprofile); // alternative 2: remotely desiredcapabilities capabilities = desiredcapabilities.firefox(); capabilities.setcapability(firefoxdriver.profile, firefoxprofile); webdriver driver = new remotewebdriver(new url("http://localhost:4444/wd/hub"), capabilities);

i have implemented automated installation of opera , safari extensions, , have been merged upstream:

operadriver: https://github.com/operasoftware/operadriver/pull/93 safaridriver: https://github.com/seleniumhq/selenium/pull/87 opera

this api similar firefoxdriver.

class="lang-java prettyprint-override">file file = new file("extension.oex"); // must end ".oex" operaprofile operaprofile = new operaprofile(); operaprofile.addextension(file); // alternative 1: locally webdriver driver = new operadriver(operaprofile); // alternative 2: remotely desiredcapabilities capabilities = desiredcapabilities.opera(); capabilities.setcapability("opera.profile", operaprofile); webdriver driver = new remotewebdriver(new url("http://localhost:4444/wd/hub"), capabilities); safari

this api similar chromedriver.

class="lang-java prettyprint-override">file file = new file("extension.safariextz"); safarioptions options = new safarioptions(); options.addextensions(file); // alternative 1: locally. webdriver driver = new safaridriver(options); // alternative 2: remotely desiredcapabilities capabilities = desiredcapabilities.safari(); capabilities.setcapability(safarioptions.capability, options); webdriver driver = new remotewebdriver(new url("http://localhost:4444/wd/hub"), capabilities); internet explorer

good luck.

selenium cross-browser browser-plugin

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -