Closed thomas-lee closed 7 years ago
I assume that you are using geckodriver and a modern version of firefox?
If that's the case, after fighting with geckodriver and selenium-server (the key thing is to have geckodriver in the PATH), I figured that the prefs are now the following:
fp.setPreference('browser.startup.homepage', 'http://saadtazi.com');
fp.setPreference('browser.startup.page', '1'); // defaults to 0, which means 'Blank Page'
Note that browser.startup.page
seems to correspond to the following dropdown:
and that the profile needs to be placed under moz:firefoxOptons
:
{
browserName:'firefox',
marionette: true, // <-- it took me a while to figure out this one too!
// firefox_profile: zippedProfile // <-- Not here...
'moz:firefoxOptions': {
profile: zippedProfile // <-- ... but here
}
}
I hope it helps.
Note that I updated examples/example-wd.js
in master
(+ added some hints in the README)
Feel free ask any questions, or close the issue if this works for you.
Thanks a lot, i can set the profile right now.
FYI, it seems firebug is deprecated and it seems need to sign or sth or firebug is a legacy extension. So it won't enable/open the firebug automatically according to your sample firefox profile preference in the latest firefox version.
Btw, i want to extract the browser console log from firefox just like chrome. I saw firefox is not currently supported with the webdriver API completely, so I can't get log (type browser) from the webdriver API directly. https://github.com/SeleniumHQ/selenium/issues/1161
I am not sure if i can get the browser log in other ways. I saw there are capabilities and example online about preferences. https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
fp.setPreference("webdriver.log.file", "/tmp/firefox_console");
I can't find any files generated.
Also tried with
fp.setPreference('webdriver.log.driver', 'DEBUG');
fp.setPreference('marionette.logging', 'DEBUG');
fp.setPreference('extensions.logging.enabled', true);
fp.setPreference('webdriver.firefox.logfile', '/tmp/ff_log');
Do you have any ideas how i can get the firefox browser log from standalone selenium running with firefox driver (need to capture and send back to the client) ?
Is it possible to override the console method and get it back using js later ?
Another question is about fp.setPreference('saadt.coucou', 'console');
I don't understand what its usage..to get console ?
Thanks
Not sure how to get the log writen to a file, but there is a selenium command that allows to retrieve the log by type: POST /session/:sessionId/log (corresponding wdjs method: .log(type). Check here: https://github.com/admc/wd/blob/master/doc/api.md (i didn't test it myself...)
Note that there is a pending issue re: geckodrivee and error log: https://github.com/mozilla/geckodriver/issues/330
Thanks for your information.
I have tried getLogType api, only 'server' is returned.
So it looks we can't get firefox browser log directly right now.
Tried to show the default homepage on firefox. But it didn't show the home page and it seems the options is not set. Any idea?
Env: FIREFOX_VERSION=55.0.3 GECKODRIVER_VERSION=0.18.0 selenium 3.5.3-astatine using this docker image https://hub.docker.com/r/selenium/node-firefox/