simone
simone

Reputation: 5227

WebGL with WWW::Mechanize::Chrome (and others)

I need to run an automated process accessing WebGL inside an iFrame - headless, and after a login.

Up until now I've attempted to do this in different ways:

The latter is run like this:

my $mech = WWW::Mechanize::Chrome->new(
                       headless => 0,
                       launch_exe => '/usr/bin/xvfb-run -a --server-args="-screen 0 1280x800x24 -ac -nolisten tcp -dpi 96 +extension RANDR" /usr/bin/google-chrome',
                       launch_arg => ["--headless" , "--no-sandbox"],
                      );

Is there something I haven't tried that could work? I am using perl - but might grudgingly try Python if there's a chance it will work.

Upvotes: 1

Views: 334

Answers (2)

ddick
ddick

Reputation: 1

I've added some documentation to show how to get WebGL working with Firefox::Marionette if you're still interested. Specifically you need to initialise like so;

my $firefox = Firefox::Marionette->new( addons => 1, visible => 1 );

Upvotes: 0

simone
simone

Reputation: 5227

xvfb-run must be prepended to the perl script like this

/usr/bin/xvfb-run -a --server-args="-screen 0 1280x800x24 \
    -ac -nolisten tcp -dpi 96 +extension RANDR" \
    perl chrome_script.pl

so it wraps the script, and the chrome instance inside it.

See the manual for xvfb-run

Upvotes: 1

Related Questions