在Ubuntu 14.04上运行Headless Chrome中的Flash网页

时间:2017-04-15 20:40:49

标签: google-chrome ubuntu flash cucumber headless

我正试图在Ubuntu 14.04(EC2实例,因此没有GUI)上使用Chrome无头地运行我的Cucumber测试。到目前为止,我的设置允许此操作,如下面的屏幕截图所示:

Successful Screenshot

当我来到带有闪光灯的页面时,我遇到了一个问题:

Flash page

我重新启动了EC2实例并杀死了所有chrome进程,仍然没有任何乐趣。

为了澄清,测试将开始,chrome打开带有flash的页面,我收到此消息。如果我然后结束测试并再次启动它我会遇到同样的问题。我想这实际上并没有重新启动chrome,因为它每次都是一个新实例?

因此,为了运行这些测试,我使用xvfb gem here作为Google Chrome 57.0.2987.133的接口。

我有libflashplayer.so并使用https://askubuntu.com/questions/14629/how-do-i-enable-the-partner-repository

/opt/google/chrome/plugins添加到sudo apt-get install pepperflashplugin-nonfree sudo update-pepperflashplugin-nonfree --install

我尝试过的一些额外内容包括:

pepperflashpluginpath

有没有办法让这个工作,所以我可以渲染基于闪存的网站?每次打开chrome时是否需要启用Flash插件?我希望我错过了一些明显的东西。

更新

我在创建Chrome个人资料时尝试设置Capybara.register_driver :chrome do |app| chrome_binary = '/usr/bin/google-chrome' Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => { "binary" => chrome_binary, "args" => ["--ppapi-flash-path=/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so"] }) Capybara::Selenium::Driver.new(app, :browser => :chrome, :desired_capabilities => capabilities) end ,但这仍然无效:

#ifndef WIDGET_H
#define WIDGET_H

#include <QPaintEvent>
#include <QWidget>

class Widget : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(QRect nrect READ nRect WRITE setNRect)

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

    QRect nRect() const;
    void setNRect(const QRect &rect);

protected:
    void paintEvent(QPaintEvent *event);

private:

    QRect mRect;
};

#endif // WIDGET_H

由于

1 个答案:

答案 0 :(得分:4)

希望这会有所帮助,但有三个关键部分可以让它发挥作用

安装Chromium浏览器

sudo apt-get install chromium-browser (at time this installed version 58)

Chrome二进制文件现已安装在

/usr/bin/chromium-browser

安装Flash插件

https://askubuntu.com/questions/531672/how-to-install-flash-payer-in-ubuntu-14-04-lts

首先转到/etc/apt/sources.list并取消注释

deb http://archive.canonical.com/ubuntu trusty partner
deb-src http://archive.canonical.com/ubuntu trusty partner

然后运行

sudo apt-get update
sudo apt-get install adobe-flashplugin

这将安装Flash插件

/usr/lib/adobe-flashplugin/libflashplayer.so

安装Chrome驱动程序

然后运行

sudo apt-get install chromium-chromedriver
sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/chromedriver

这就是它,任何特定的问题都只是发表评论,因为我可能已经错过了一些东西,但是这些让我运行这个黄瓜无头的步骤

相关问题