2010-08-02 81 views

回答

1

禁用在瀏覽器中顯示圖像手動Watir驅動器,然後運行Watir腳本。據我所知,你不能從Watir本身做到這一點。

1

我認爲它可以:

 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/

+0

非常感謝你。它運作良好。 :) – 2017-07-13 05:17:57

1
prefs = { 
    :profile => { 
     :managed_default_content_settings => { 
      :images => 2 
     } 
    } 
} 

b = Watir::Browser.new :chrome, :prefs => prefs 
相關問題