Skip to content

Instantly share code, notes, and snippets.

@elgalu
Last active December 31, 2015 22:48
Show Gist options
  • Save elgalu/8055613 to your computer and use it in GitHub Desktop.
Save elgalu/8055613 to your computer and use it in GitHub Desktop.
AngularJS apps testing through Karma and Protractor
// Browser capabilities examples
// PhantomJS
// Note this config assumes the executable is in the $PATH but you can force an absolute path if you like
selenium.webdriver.phantomjs.webdriver.WebDriver(
executable_path='phantomjs',
port=0,
desired_capabilities = {
'platform': 'ANY',
'browserName': 'phantomjs',
'version': '',
'javascriptEnabled': True
}
)
// Make sure the page is an Angular page.
driver.executeAsyncScript(clientSideScripts.testForAngular, 10).
then(function(hasAngular) {
if (!hasAngular) {
throw new Error('Angular could not be found on the page ' + destination);
}
});
# Install PhantomJS
npm install phantomjs
#=> phantomjs@1.9.2-5 ; Binary available at ~/node_modules/phantomjs/lib/phantom/bin/phantomjs
# Test PhantomJS
phantomjs --version
#=> 1.9.2
phantomjs --webdriver=9515
#=> PhantomJS is launching GhostDriver... GhostDriver - Main - running on port 9515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment