代码之家  ›  专栏  ›  技术社区  ›  Shubham

如何在watir中阻止图像?

  •  4
  • Shubham  · 技术社区  · 16 年前

    我正在使用 Watir 对于不需要加载任何图像的数据提取作业。有可能阻止他们吗?

    3 回复  |  直到 9 年前
        1
  •  1
  •   Željko Filipin    16 年前

    禁用在浏览器watir驱动器中手动显示图像,然后运行watir脚本。据我所知,你不能从瓦蒂尔身上做到这一点。

        2
  •  2
  •   Prem Anand    9 年前

    我想可能是:

            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/

        3
  •  1
  •   Endo Takanobu    10 年前
    prefs = {
        :profile => {
            :managed_default_content_settings => { 
              :images => 2
            }
        }
    }
    
    b = Watir::Browser.new :chrome, :prefs => prefs
    
    推荐文章