-
Notifications
You must be signed in to change notification settings - Fork 61
Setup Instructions
Parashuram N edited this page Mar 7, 2014
·
15 revisions
Browser-perf requires selenium to launch the browsers and collect metrics. The following options can be used to setting up selenium
- Ensure that you have Java installed.
- Download Selenium Server (formerly the Selenium RC Server)
- Download the latest WebDriver for Chrome from here for your operating system.
- Start the selenium server locally using
java -jar selenium-server-standalone-2.40.0.jar -Dwebdriver.chrome.driver=chromedriver.exe. Don't forget to correct the filename of the jar and Chrome driver file - Wait till you see the logs that say Selenium has started.
- Browser-perf can now be run
- Using the command line
browser-perf http://url.com --selenium=localhost:4444 --verbose - Or using the Node API, setting the selenium key in the options variable to
http://localhost:4444/wd/hub
- Saucelabs and Browserstack provides hosted selenium. You would just need to connect to their servers. Note that if the site under test is not accessible over the internet, the tunnel module may need to be used.
- Set the
seleniumoption for the command line or your node module toondemand.saucelabs.comorhub.browserstack.com. - Set the
usernameandaccesskeyparameters to the corresponding user name and access key. This tool will automatically take care of adding the credentials either to the capabilities in case of browserstack or to the selenium url in case of saucelabs.
View the Node Module API page for details on how to set the options.
- Pre-req: Android tools and your Cordova Android application.
- Ensure that you have your Cordova application installed on the emulator or the device
- Ensure that the adb server is started using
adb start-server. - Ensure that your target emulator or device is connected using
adb devices - Download the latest WebDriver for Chrome from here for your operating system.
- Start the Chrome driver. It usually starts on 9515.
- Set the
seleniumoption for the the node module tohttp://localhost:9515/. If you specified a--url-basewhen starting the Chrome driver, ensure that it is included in the selenium tab. Here is a sample of how to use it in your node program.
Here is how the code would look like.
var browserPerf = require('../../');
browserPerf(undefined, function(err, res) {
if (err) {
console.log(err);
} else {
console.log(res);
}
}, {
selenium: 'http://localhost:9515', //chrome driver port
browsers: [{
browserName: 'android',
chromeOptions: {
androidActivity: 'io.cordova.hellocordova.HelloCordova', // name of your activity
androidPackage: 'io.cordova.hellocordova' // name of the package
},
loggingPrefs: {
performance: 'ALL'
}
}]
});