如何在Watir中屏蔽图像?

时间:2010-08-02 08:55:38

标签: ruby watir

我正在使用Watir进行数据提取工作,我不需要加载任何图像。是否有可能阻止它们?

4 个答案:

答案 0 :(得分:3)

使用:

webkit: { webprefs: { loads_images_automatically: false } } or profile: { default_content_setting_values: { images: 2 } }

答案 1 :(得分:2)

我认为可以是:

        profile = Selenium::WebDriver::Chrome::Profile.new
        profile['webkit.webprefs.loads_images_automatically'] = false

        @browser = Watir::Browser.new :chrome, :profile => profile

请参阅:http://watir.github.io/docs/chrome/

答案 2 :(得分:1)

禁止在浏览器中手动显示图像Watir驱动器,然后运行Watir脚本。据我所知,你不能从Watir本身那里做到。

答案 3 :(得分:1)

<a href="deleteBatch.do?batchId=12hgxb4"