Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Taking screenshot of flash object using Selenium with Webdriver

When I take a screenshot using Selenium Firefox Webdriver (yes, Firefox has flash plugin) it doesn't show the flash object. It shows merely a white box instead. Is there something I must do / install?

I'm using this code:

from selenium import webdriver

def webshot(url, filename):
    browser = webdriver.Firefox()
    browser.get(url)
    browser.save_screenshot(filename)
    browser.quit()
like image 428
Cruel Avatar asked Oct 04 '11 01:10

Cruel


1 Answers

In order to get this working, I had to use the wmode=transparent attribute. But obviously, this will depend on whether you can edit the source of the webpage you're trying to screenshot.

To edit an existing HTML page, add the WMODE parameters to the HTML code.

Add the following parameter to the OBJECT tag:

 <param name="wmode" value="transparent">

Cheers, ns

like image 192
nonshatter Avatar answered Feb 19 '23 09:02

nonshatter