Skip to content

Commit

Permalink
update instructions and examples for geckodriver firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
saadtazi committed Sep 9, 2017
1 parent a47a7ba commit 63c5c39
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 20 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ Make sure you have selenium server running... or use 'selenium-webdriver/remote'

```js
/******************************************************************
* with selenium webdriverJs
* with old version selenium webdriverJs
* WARNING: does not work with recent version of selenium-webdriver node bindings, which expect an instance of selenium-webdriver Firefox Profile page (`require('selenium-webdriver/firefox').Profile` or similar)
* @see: https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox/profile_exports_Profile.html
* installs firebug
* and make http://saadtazi.com the url that is opened on new tabs
/******************************************************************/
Expand Down Expand Up @@ -129,11 +131,20 @@ Make sure you have selenium server running... or use 'selenium-webdriver/remote'
return;
}
browser = wd.promiseChainRemote();
// firefox 46-
//browser.init({
// browserName:'firefox',
// // set firefox_profile capabilities HERE!!!!
// firefox_profile: zippedProfile
//}).
// firefox 47+
browser.init({
browserName:'firefox',
// set firefox_profile capabilities HERE!!!!
firefox_profile: zippedProfile
}).
browserName:'firefox',
marionette: true,
'moz:firefoxOptions': {
profile: zippedProfile
}
})
// woOot!!
get('http://en.wikipedia.org');
});
Expand Down
53 changes: 38 additions & 15 deletions examples/example-wd.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,45 @@ fp.setPreference('extensions.firebug.script.enableSites', true);
fp.setPreference('extensions.firebug.currentVersion', '2.0.1');
fp.setPreference('extensions.firebug.defaultPanelName', 'console');
fp.setPreference('saadt.coucou', 'console');
fp.setPreference('browser.startup.homepage', 'http://saadtazi.com');
// fp.setPreference('browser.startup.homepage_welcome_url', 'http://saadtazi.com');
// fp.setPreference('startup.homepage_welcome_url', 'http://saadtazi.com');
fp.setPreference('browser.startup.page', '1');

fp.updatePreferences();
// you can install multiple extensions at the same time
fp.addExtensions(['../test/extensions/firebug-2.0.1-fx.xpi'], function() {
fp.encoded(function(err, zippedProfile) {
if (err) {
console.log('oops, error!', err);
return;
}
browser = wd.promiseChainRemote();
browser.init({
fp.encoded(function(err, zippedProfile) {
if (err) {
console.log('oops, error!', err);
return;
}
browser = wd.remote({
protocol: 'http:',
hostname: '127.0.0.1',
port: '4444',
// pathname: '/' // if you use geckodriver directly (without selenium server)
}, 'promiseChain');
browser.init({
browserName:'firefox',
// set firefox_profile capabilities HERE!!!!
firefox_profile: zippedProfile
}).
// woOot!!
get('http://en.wikipedia.org');
});
});
marionette: true, // firefox 47+
'moz:firefoxOptions': {
// set firefox profile capabilities HERE!!!!
profile: zippedProfile
}
})
// NOTE: for non-geckodriver user with firefox 46 or older
// the capability needs to be something like:
// {
// browserName:'firefox',
// firefox_profile: zippedProfile
// }

// woOot!!
.get('http://en.wikipedia.org')
.then(() => console.log('here'))
.catch((err) => console.log('rrrrr::', err))
});



setTimeout(() => console.log('done'), 15000)

0 comments on commit 63c5c39

Please sign in to comment.