Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Skip image loading by selenium

How to skip image loading using selenium webdriver for cucumber test cases. My test cases are failing due to image is not loading properly. a spinner a rolling when i see in Net tab in firebug.

like image 928
vijay chouhan Avatar asked Nov 04 '22 05:11

vijay chouhan


1 Answers

FirefoxDriver supports loading strategy that doesn't require page to fully load. Thus driver will return without waiting for images to load:

Capybara.register_driver :firefox do |app|
  profile = Selenium::WebDriver::Firefox::Profile.new
  profile['webdriver.load.strategy'] = 'unstable'
  Capybara::Selenium::Driver.new(app, :browser => :firefox, profile: profile)
end
Capybara.default_driver = :firefox
like image 54
Andrei Botalov Avatar answered Nov 09 '22 16:11

Andrei Botalov