chintamani bapat
chintamani bapat

Reputation: 11

How to make permanent settings to chrome driver

As chrome has blocked Java, Silverlight and other plugins by default now. So to make it work we need to Enable the NPAPI in chrome://flags and restart the browser to make the setting into effect,the same needs to be done in chrome driver however the setting gets lost after restarting the chrome driver, is there any way to make the permanent settings into chrome driver?

Upvotes: 1

Views: 2863

Answers (2)

owgitt
owgitt

Reputation: 323

When you open a new instance[profile] of the chrome browser every time, npapi flag can be enabled by using following line:

browser = Watir::Browser.new :chrome,:switches => %w[--enable-npapi]

Upvotes: 0

Pekka
Pekka

Reputation: 2280

My earlier comment was wrong because desired capabilities is for non-browser specific settings like proxy address. If you want to modify Chrome behavior, you need to use ChromeOptions. Create Webdriver keyword was created for special cases like this:

*** Settings ***
Library         Selenium2Library

*** Test Cases ***
Stackoverflow
    ${options}=  Evaluate  sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver
    Call Method    ${options}    add_argument      always-authorize-plugins
    Call Method    ${options}    add_argument      enable-npapi
    Create WebDriver  Chrome    chrome_options=${options}
    Go To    https://www.java.com/verify
    Close All Browsers

Upvotes: 3

Related Questions