¿Cómo ejecutar Chrome / Firefox con el complemento flash deshabilitado desde el script watir?

¿Cómo ejecutar Chrome / Firefox con el complemento flash deshabilitado desde el script watir?

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

preguntado el 09 de marzo de 12 a las 15:03

2 Respuestas

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"

Más información: 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"]

Más información: 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

respondido 14 mar '12, 02:03

Probablemente debería ser browser = Watir::Browser.new :chrome, :switches => %w[--disable-internal-flash] for Chrome to work. Will check that out when return to work on monday. Thanks for your suggestions, you helped me very much. - mihijs

%w[--disable-internal-flash] es exactamente lo mismo que ["--disable-internal-flash"]. - Željko filipina

I tried and it works fine with Firefox, but for Chrome I could not disable Flash plugin even with Watir::Browser.new :chrome, :switches => %w[--disable-internal-flash --disable-bundled-ppapi-flash --disable-flash-sandbox]. - mihijs

@mihijs: same here, I was not able to disable flash in Chrome. - Željko filipina

Utilice el --disable-bundled-ppapi-flash switch. The one above did not work for me.

Respondido el 15 de enero de 14 a las 13:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.