Chromedriver lets us set preferences via capabilities when it is initiated by Webdriver. These preferences can be used for specific purposes for example disabling images can reduce network needs and fasten the test runs; and disabling popups can make your cases more stable by reducing non-deterministic cases. In this post I want to explain how to use these feature of Chromedriver for Capybara with Ruby, you can also apply the same method for other languages with their bindings.
Sometimes bandwidth is crucial if you have parallel pipelines for test runs. Think that you have 10 parallel pipes and very pipeline consume bandwidth to complete its tasks, the most heavy part of website generally images. If we disable the images we can fasten the overall test runs. To disable the images you should set the images option to 2 in preferences. For Capybara you can disable the images by following Chrome instance:
Sometimes you need to disable popups which intermittently occurs and make your cases flacky. These kind of popups generally controls by another team of the company such instant campaign popups by CRM teams, and etc. To disable the popups, you should set the popups option to 2 in preferences. For Capybara you can disable the popups by following Chrome instance:
Sometimes you need to make chrome fullscreen for UI related problems. You can set chrome instance as a full-screened view by passing the argument "--start-fullscreen" in args so it will open full page as default by the following Chrome instance. If you want to add more command line arguments you can add it separating by comma "--disable-infobars" this disables the information bars on the top of the page. See the example:
Sure we can use combination of these features together. The important point is that you need to know which features are under preferences and which features are arguments. For maximized windows, disabled images and popups check the following Chrome instance:
To check whole list of args click this link and the whole list of preferences check this link or see the list of preferences below: