How to pass chrome.switches on RemoteWebDriver

2,806 views
Skip to first unread message

elgalu

unread,
Sep 12, 2011, 10:31:13 PM9/12/11
to webdriver
Hi,

I was able to pass chrome.switches when using webdriver, e.g.
--ignore-certificate-errors --disable-popup-blocking --disable-
translate

Now i started using RemoteWebDriver and i can't find documentation to
do the same thing for Chrome browser.

I'm using ruby bindings and no chrome switches seems to be available
on:
Selenium::WebDriver::Remote::Capabilities

See:
http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/WebDriver/Remote/Capabilities.html#internet_explorer-class_method


regards
-Leo

Krishnan Mahadevan

unread,
Sep 13, 2011, 11:02:35 AM9/13/11
to webd...@googlegroups.com
Here is how you would do it using RemoteWebDriver (I am using Java)

DesiredCapabilities dc = DesiredCapabilities.chrome();
String[] switches = { "--ignore-certificate-errors", "--disable-popup-blocking"," --disable-translate"};
dc.setCapability("chrome.switches", Arrays.asList(switches));
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://mygrid:4444/wd/hub"),dc);

Make sure you are starting the remote webdriver node as below:

java -jar selenium-server-standalone-2.5.0.jar -role webdriver -Dwebdriver.chrome.driver="C:/selenium/chromedriver.exe" -hub http://mygrid:4444/grid/register -port 5556 


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.


Leo Gallucci

unread,
Sep 13, 2011, 1:54:06 PM9/13/11
to webd...@googlegroups.com
Thanks you!!

I could figure it out looking at your java code.

This is how it finally worked out (ruby code)


# Gemfile sample
gem 'capybara', '~> 1.1.1'
gem 'selenium-webdriver', '~> 2.5.0'

# Chrome mini sample app
require 'capybara'
require 'selenium-webdriver'
# localhost sample
chrome_switches = %w[--ignore-certificate-errors --disable-popup-blocking --disable-translate]
caps_opts = {'chrome.switches' => chrome_switches}
caps = Selenium::WebDriver::Remote::Capabilities.chrome(caps_opts)
opts = {
  :browser => :remote,
  :url => "http://127.0.0.1:4444/wd/hub",
  :desired_capabilities => caps
}
#...
Capybara.register_driver :selenium do |app|
  Capybara::Selenium::Driver.new(app, opts)
end
#...


thanks!!!
--------------------------------------------
Leo Gallucci @elgalu

sheeba.a...@gmail.com

unread,
Jan 27, 2016, 5:50:11 AM1/27/16
to webdriver
Hi ,

Anyone has any suggestions how to disable the popups in chrome driver using Selenium Webdriver?. I am using selenium Webdriver to switch to new tab, but the popup blocks the page to load. 

Driver.FindElement (By.Id("override")).click(); - To click on the element

Driver.SwitchTo().Window(Driver.WindowHandles.Last()); - To navigate to nexttab
Reply all
Reply to author
Forward
0 new messages