Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 717
mihijs Avatar asked Jan 19 '26 07:01

mihijs


1 Answers

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
like image 146
Željko Filipin Avatar answered Jan 22 '26 02:01

Željko Filipin