Search code examples
seleniuminternleadfoot

Can I use Selenium methods together with Intern/Leadfoot methods?


I would like to use some Selenium methods together with Intern/Leadfoot methods. How can I do it? Do I have to do it after promise returned, right? Like the following code? Are there other ways to do it?

   ...
   var webdriver = require('intern/dojo/node!selenium-webdriver');
   ...
    .findByXpath('//button[@class="btn btn-success"]')
      .click()
      .end()
    .sleep(1000)
    .then(function (text) {
      webdriver.switchTo().alert().accept();
    });
}

Solution

  • These two libraries are not currently compatible. Each has its own internal state that is updated as commands are executed, and changes made using one would only confuse the other (assuming that they were both able to implicitly communicate with the same remote browser).

    At least for the specific case in the originally posted example, Leadfoot does have an acceptAlert method that is the equivalent of web driver.switchTo().alert().accept().