用Webdriver使用Selenium来截图Flash对象 [英] Taking screenshot of flash object using Selenium with Webdriver

查看:530
本文介绍了用Webdriver使用Selenium来截图Flash对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Selenium Firefox Webdriver(是的,Firefox有Flash插件)截图时,它不显示Flash对象。它只是显示一个白色的盒子。有什么我必须做的/安装?

我使用此代码:

  from selenium import webdriver 
$ b $ def webshot(url,filename):
browser = webdriver.Firefox()
browser.get(url)
browser.save_screenshot(filename)
browser.quit()


解决方案

要编辑现有的HTML页面,请将WMODE参数添加到HTML代码中。



添加以下参数到OBJECT标记:

 < param name =wmodevalue =transparent> 

干杯,
ns


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()

解决方案

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

这篇关于用Webdriver使用Selenium来截图Flash对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆