useXpath.js 694 B

123456789101112131415161718192021222324252627
  1. var util = require('util');
  2. var locateStrategy = require('./_locateStrategy.js');
  3. /**
  4. * Sets the locate strategy for selectors to xpath, therefore every following selector needs to be specified as xpath.
  5. *
  6. * ```
  7. * this.demoTest = function (browser) {
  8. * browser
  9. * .useXpath() // every selector now must be xpath
  10. * .click("//tr[@data-recordid]/span[text()='Search Text']");
  11. * };
  12. * ```
  13. *
  14. * @method useXpath
  15. * @param {function} [callback] Optional callback function to be called when the command finishes.
  16. * @api commands
  17. */
  18. function Command() {
  19. this.strategy = 'xpath';
  20. locateStrategy.call(this);
  21. }
  22. util.inherits(Command, locateStrategy);
  23. module.exports = Command;