Blocking Advertisement on Firefox in Selenium

Home / Uncategorized / Blocking Advertisement on Firefox in Selenium

I want to extract colors from the webpage so I am using selenium to capture screenshot of webpage but due to advertisement coming on webpage the color pallete has unwanted colors and I have created a custom profile for firefox which uses adblock, adblock gets started on webpage load but ads still appear. This is the piece of code I am using to block ads :FirefoxProfile firefoxProfile = new FirefoxProfile();
File addonpath = new File("/Users/");
System.setProperty("webdriver.gecko.driver", "/Applications/");
driver = new FirefoxDriver(firefoxProfile);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);


Read more

Leave a Reply

Your email address will not be published. Required fields are marked *