Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Xvfb在Linux上的Firefox中呈现swf文件_Java_Flash_Firefox_Selenium_Xvfb - Fatal编程技术网

Java 使用Xvfb在Linux上的Firefox中呈现swf文件

Java 使用Xvfb在Linux上的Firefox中呈现swf文件,java,flash,firefox,selenium,xvfb,Java,Flash,Firefox,Selenium,Xvfb,我想使用Java从swf文件中提取最后一帧。但是,在尝试了几种方法之后,一种有效的方法是使用selenium启动浏览器,加载swf,等待最后一帧并拍摄快照。它在我的mac电脑上运行良好。代码如下 package flash; import java.io.File; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScr

我想使用Java从swf文件中提取最后一帧。但是,在尝试了几种方法之后,一种有效的方法是使用selenium启动浏览器,加载swf,等待最后一帧并拍摄快照。它在我的mac电脑上运行良好。代码如下

package flash;

import java.io.File;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class snaphot_swf {

    public static void main(String[] args) throws Exception{
        // TODO Auto-generated method stub
        WebDriver driver = new FirefoxDriver();
        driver.get("file:///Users/test/Downloads/Car-speakers-590x90.swf");
        Thread.sleep(10000);
        File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
        // Now you can do whatever you need to do with it, for example copy somewhere
        FileUtils.copyFile(scrFile, new File("/Users/test/Documents/screenshots/screenshot.png"));
        driver.close();
        System.out.print("snapshot taken");
    }

}
我现在想在CentOS6.4中的无头浏览器上做同样的事情

我做了以下工作:

//install firefox
    yum install firefox

//install flash plugin
    rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

    yum check-update

    yum install flash-plugin nspluginwrapper alsa-plugins-pulseaudio libcurl

//install Xvfb
yum info xorg-x11-server-Xvfb

//starting Xvfb
/usr/bin/Xvfb :1 -screen 0 1024x768x24 &
export DISPLAY=:1 
现在,当我通过在firefox浏览器中加载png文件并拍摄快照来运行Java代码时,它工作得非常好。但是,当我尝试加载swf文件时,会得到一个空白快照

如何在Firefox中加载swf并获取快照