elementexplorer.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env node
  2. /**
  3. * This is an explorer to help get the right element locators, and test out what
  4. * Protractor commands will do on your site without running a full test suite.
  5. *
  6. * This beta version only uses the Chrome browser.
  7. *
  8. * Usage:
  9. *
  10. * Expects a selenium standalone server to be running at http://localhost:4444
  11. * from protractor directory, run with:
  12. *
  13. * ./bin/elementexplorer.js <urL>
  14. *
  15. * This will load up the URL on webdriver and put the terminal into a REPL loop.
  16. * You will see a > prompt. The `browser`, `element` and `protractor` variables
  17. * will be available. Enter a command such as:
  18. *
  19. * > element(by.id('foobar')).getText()
  20. *
  21. * or
  22. *
  23. * > browser.get('http://www.angularjs.org')
  24. *
  25. * try just
  26. *
  27. * > browser
  28. *
  29. * to get a list of functions you can call.
  30. *
  31. * Typing tab at a blank prompt will fill in a suggestion for finding
  32. * elements.
  33. */
  34. console.log('Please use "protractor [configFile] [options] --elementExplorer"' +
  35. ' for full functionality\n');
  36. if (process.argv.length > 3) {
  37. console.log('usage: elementexplorer.js [url]');
  38. process.exit(1);
  39. } else if (process.argv.length === 3) {
  40. process.argv[2] = ('--baseUrl=' + process.argv[2]);
  41. }
  42. process.argv.push('--elementExplorer');
  43. require('../built/cli.js');