如何在 Watir 中屏蔽图像?

Shu*_*ham 5 ruby watir

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

mpz*_*mpz 3

我认为可以是:

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

        @browser = Watir::Browser.new :chrome, :profile => profile
Run Code Online (Sandbox Code Playgroud)

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