使用 Selenium 和 Webdriver 截取 flash 对象的屏幕截图 [英] Taking screenshot of flash object using Selenium with Webdriver

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

问题描述

当我使用 Selenium Firefox Webdriver(是的,Firefox 有 flash 插件)截取屏幕截图时,它不显示 flash 对象.它仅显示一个白色框.有什么我必须做/安装的吗?

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?

我正在使用此代码:

from selenium import webdriver

def webshot(url, filename):
    browser = webdriver.Firefox()
    browser.get(url)
    browser.save_screenshot(filename)
    browser.quit()

推荐答案

为了让这个工作,我不得不使用 wmode=transparent 属性.但显然,这将取决于您是否可以编辑要截屏的网页的来源.

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.

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

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

将以下参数添加到 OBJECT 标签:

Add the following parameter to the OBJECT tag:

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

干杯,ns

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

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