index.js 677 B

123456789101112131415161718192021222324252627282930313233
  1. var webdriverio = require('webdriverio');
  2. var options = {
  3. desiredCapabilities: {
  4. browserName: 'firefox'
  5. }
  6. };
  7. console.log('lets go!');
  8. var client = webdriverio.remote(options);
  9. console.log(client);
  10. try {
  11. try {
  12. client
  13. .init()
  14. .url('https://duckduckgo.com/')
  15. .setValue('#search_form_input_homepage', 'WebdriverIO')
  16. .click('#search_button_homepage')
  17. .getTitle().then(function(title) {
  18. console.log('Title is: ' + title);
  19. // outputs:
  20. // "Title is: WebdriverIO (Software) at DuckDuckGo"
  21. })
  22. .end();
  23. }
  24. catch(e) {
  25. console.log(e);
  26. }
  27. }
  28. finally {
  29. console.log('end');
  30. }