Search code examples
rubyimagewebdriverwatirselenium-chromedriver

ChromeDriver Ruby disable images


Is there a way to disable images in Chromedriver with ruby? There is a similar question but it deals with C# and I am not exactly sure how to port it over to ruby.

Disable images in Selenium ChromeDriver


Solution

  • Looks like it requires a hash to be sent to the "profile.default_content_settings" Chrome profile setting. I would try something like this:

    profile = Selenium::WebDriver::Chrome::Profile.new
    profile["profile.default_content_settings"] = { :images => '2' }
    
    @driver = Selenium::WebDriver.for(:chrome, :profile => profile)