You can deal with this problem by using the chrome options and creating the desired features, but first of all you need to consider:
1: the value you must enter in 'user-data-dir' is the same as you can find out on the chrome: // version / route in Google Chrome. Let me explain this with the image (at the end of this answer).
ChromeOptions options = new ChromeOptions(); DesiredCapabilities capabilities = DesiredCapabilities.chrome(); options.addArguments("user-data-dir=/Users/YourUser/Library/Application Support/Google/Chrome/Profile 1"); capabilities.setCapability(ChromeOptions.CAPABILITY, options);
And after that you need to add these parameters to your driver:
driver = new ChromeDriver(capabilities);
Thus, this is the best way to request a page with ad protection enabled . .

Luillyfe
source share