extender.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { promise as wdpromise, WebDriver } from 'selenium-webdriver';
  2. export declare class Extender {
  3. driver_: WebDriver;
  4. params_: {
  5. [key: string]: string[];
  6. };
  7. executor_: {
  8. defineCommand: (name: string, method: string, path: string) => void;
  9. };
  10. constructor(driver: WebDriver);
  11. /**
  12. * Defines a new command. When a command is sent, the {@code path} will be
  13. * preprocessed using the command's parameters; any path segments prefixed
  14. * with ":" will be replaced by the parameter of the same name. For example,
  15. * given "/person/:name" and the parameters "{name: 'Bob'}", the final command
  16. * path will be "/person/Bob".
  17. *
  18. * @param {string} name The command name.
  19. * @param {string} params The names of the parameters to the command
  20. * @param {string} method The HTTP method to use when sending this command.
  21. * @param {string} path The path to send the command to, relative to
  22. * the WebDriver server's command root and of the form
  23. * "/path/:variable/segment".
  24. */
  25. defineCommand(name: string, params: string[], method: string, path: string): void;
  26. /**
  27. * Executes a command which was defined by defineCommand()
  28. *
  29. * @param {string} name The command name.
  30. * @param {*[]} params The parameters to the command
  31. * @return {webdriver.promise.Promise<*>} A promise that will be resolved with
  32. * the command result
  33. */
  34. execCommand<T>(name: string, method: string, params: any[]): wdpromise.Promise<T>;
  35. }