Selenium / Webdriver / HtmlUnit restriction for a specific domain

When using selenium / webdriver for web scraping, I realized that the google analytics script is running on the target site. Is there a way to restrict selenium / webdriver / htmlunit to avoid specific urls / domains?

Thanks,

+6
source share
1 answer

I think this is not possible, because Selenium is actually an adapter for several implementations. Therefore, it cannot refuse to load some scripts in firefox or chrome. Perhaps you can check the api driver (firefox profile, htmlunit configuration file) to accomplish this.

+3
source

Source: https://habr.com/ru/post/891293/


All Articles