How to run Chrome/Firefox with disabled flash plugin from watir script?

≡放荡痞女 提交于 2019-11-29 22:46:09

问题


How to run Chrome/Firefox with disabled flash plugin from watir script?

If I disable flash in Chrome, next time when I execute watir-webdriver script Flash is enabled again.


回答1:


For Firefox it is easy. Disable flash in your default profile (the one you normally use) and then start the browser like this:

browser = Watir::Browser.new :firefox, :profile => "default"

More information: http://watirwebdriver.com/firefox/

For Chrome I thought this would do it, but looks like I am doing something wrong, since flash is enabled:

browser = Watir::Browser.new :chrome, :switches => ["--disable-internal-flash"]

More information: http://watirwebdriver.com/chrome/

Workaround is to run this every time you want Flash disabled in Chrome:

browser.goto "about:plugins"
browser.span(:text => "Flash").parent.parent.parent.a(:text => "Disable", :class => "disable-group-link").click



回答2:


Use the --disable-bundled-ppapi-flash switch. The one above did not work for me.



来源:https://stackoverflow.com/questions/9636255/how-to-run-chrome-firefox-with-disabled-flash-plugin-from-watir-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!