I fix the problem by following nonshatter's advice. I was screenshotting external pages, so I had to change wmode to "transparent" at runtime. Therefore, I needed to change all the EMBED and OBJECT using javascript. I found this nice script: http://www.onlineaspect.com/2009/08/13/javascript_to_fix_wmode_parameters/
So I simply made a script to execute that and uploaded to "mysite.com/myscript.js" and now the working script here:
from selenium import webdriver
script = '''
var s = document.createElement('script');
s.src = 'http://mysite.com/myscript.js';
document.body.appendChild(s);
'''
def webshot(url, filename):
browser = webdriver.Firefox()
browser.get(url)
browser.execute_script(script)
browser.save_screenshot(filename)
browser.quit()
As far as I can tell from scanning the javascript, it should work for nearly any flash case. I've only done a few tests, but I can at least verify that it works when screenshotting youtube pages with video playing.