将Selenium/Webdriver/HtmlUnit限制为某个域 [英] Restricting Selenium/Webdriver/HtmlUnit to a certain domain

查看:51
本文介绍了将Selenium/Webdriver/HtmlUnit限制为某个域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用selenium/webdriver进行网络抓取时,我意识到目标站点正在运行google Analytics脚本.有没有一种方法可以限制selenium/webdriver/htmlunit来避免某些url/域?

While using selenium/webdriver for web scraping, I realized the target site has google analytics script running. Is there a way to restrict selenium/webdriver/htmlunit to avoid certain urls/domains ?

谢谢

推荐答案

我认为这是不可能的,因为Selenium实际上是几种实现的适配器.因此,他不能拒绝将某些脚本加载到Firefox或chrome.也许您可以检查驱动程序api(firefox配置文件,htmlunit配置文件)来完成此操作.

I think it is impossible becouse Selenium is actually adapter for several implementation. So he can't deny to load some scripts to firefox or chrome. Perhaps you can check driver api(firefox profile, htmlunit configuration file) to accomplish this.

这篇关于将Selenium/Webdriver/HtmlUnit限制为某个域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆