- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Disable images in Selenium Google ChromeDriver?
We can disable images in Selenium Google chromedriver. The images are disabled so that page load is quicker and execution time is also less. In chromedriver, we have to configure the below browser parameter −
profile.managed_default_content_settings.images, and set its value to 2.
Syntax
p.put("profile.managed_default_content_settings.images", 2);
Let’s try to disable images from the below page −
Example
Code Implementation.
import org.openqa.selenium.By; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import java.util.HashMap; import java.util.Map; public class ImageDisable { public static void main(String[] args) throws IOException { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); Map<String, Object> p = new HashMap<String, Object>(); // browser setting to disable image p.put("profile.managed_default_content_settings.images", 2); //capabilities added to browser ChromeOptions opt = new ChromeOptions(); opt.setExperimentalOption("prefs", p); // associating desired capabilities to browser WebDriver driver = new ChromeDriver(opt); driver.get("https://www.tutorialspoint.com/about/about_careers.htm"); } }
Output
- Related Articles
- Disable images in Selenium Google ChromeDriver.
- How to perform right click using Selenium ChromeDriver?
- How to disable Google Chrome autofill option?
- How to download Google Images using Python
- How to disable Javascript when using Selenium?
- Set Chrome's language using Selenium ChromeDriver
- How to use Selenium webdriver to click google search?
- How to automate google Signup form in Selenium using Python?
- Error:selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH using Selenium
- How to search for a keyword in google using Selenium Java?
- Take screenshot of full page with Selenium Python with chromedriver.
- How to start ChromeDriver in headless mode?
- Google Search Automation with Python Selenium
- Can Google Chrome be supported by Selenium IDE?
- How can I control Chromedriver open window size?

Advertisements