david-dick / firefox-marionette

This is a client module to automate the Mozilla Firefox browser via the Marionette protocol
https://metacpan.org/dist/Firefox-Marionette
Other
12 stars 3 forks source link

cannot drive existing profile #8

Closed stuart-little closed 3 years ago

stuart-little commented 3 years ago

I am running the following, after having created a throwaway new profile called throw:

#!/usr/bin/env perl
use warnings;
use v5.12;

use Firefox::Marionette;

my $url='https://www.google.com';
my $firefox = Firefox::Marionette->new(
    profile_name => 'throw',
    visible => 1,
    )->go($url);
sleep;

This opens up a browser window on the default startup page Firefox gives new profiles (screenshot here), but hangs there.

It never reaches google.com, and pegs one of my CPUs to 100%.

Edit

Actually, it hangs even without the sleep; directive at the end. Removing that last line makes no difference.

Nor does setting my profile's homepage to blank. If I do that, then running that script results in a window hung on that initial blank page (again with a 100%-spinning CPU).

stuart-little commented 3 years ago

Here's what I get when running the following command in a clone of this repo:

$ perl -Ilib -MFirefox::Marionette -e 'my $firefox = Firefox::Marionette->new( debug => 1, visible => 1, profile_name => 'throw'); ' 
** firefox --version
** firefox -marionette -safe-mode -P throw

And it hangs there, again spinning up a CPU to full throttle. I have to kill the process with Ctrl+C.

I've also checked that running just that last hanging line in a terminal, on its own, without invoking Firefox::Marionette, works fine:

$ firefox -marionette -safe-mode -P throw

This opens up a Firefox window and does not hog a CPU. I can also visit web pages:

$ firefox -marionette -safe-mode -P throw 'www.google.com'

starts me up on google, again with no excessive CPU work.

david-dick commented 3 years ago

Ok. I've verified this one. Bit busy at the moment, will get to it on the weekend.

stuart-little commented 3 years ago

Thanks! Some more possibly-related info follows.

I've also tried to use a copy of the existing profile instead, passing profile instead of profile_name (as per the documentation). So:

perl -Ilib -MFirefox::Marionette -e 'my $profile = Firefox::Marionette::Profile->existing('throw'); my $firefox = Firefox::Marionette->new( debug => 1, visible => 1, profile => $profile );  $firefox->go("https://www.google.com");  '

This again hangs and fails to load the google page (it just freezes on a blank page), but with more complaints:

** firefox --version
** firefox -marionette -safe-mode -profile /tmp/firefox_marionette_local_uMOkW5MQKkw/profile --no-remote --new-instance
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:9: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:56: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:57: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:58: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:59: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:63: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:67: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:92: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:123: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:176: prefs parse error: integer literal overflowed
/tmp/firefox_marionette_local_uMOkW5MQKkw/profile/prefs.js:237: prefs parse error: integer literal overflowed

I am having no trouble basing a profile off of this one with Python's Selenium Webdriver, via its firefox_profile option. So I don't know why prefs.js would pose a problem if I try to peruse it through Firefox::Marionette instead..

david-dick commented 3 years ago

Just committed a fix for this. Can you confirm this fixes the issues in this bug?

stuart-little commented 3 years ago

Yes, that did it. I

So yeah, this seems to have fixed it, and I think it's safe to close this. Thank you!