Selenium WebDriverJs命令

Dan*_*Dan 10 selenium webdriver selenium-webdriver

我是第一次运行Node.js + Mocha + Selenium Webdriverjs的组合.我根据他们的文档设置了所有内容https://code.google.com/p/selenium/wiki/WebDriverJs,但我发现很难找到通过网络驱动程序提供的所有命令的列表.是否有使用Selenium webdriverjs编写测试时可用的命令列表?

例如,如何使用Javascript实现以下java代码

new Wait("Couldn't find close button!") {
  boolean until() {
    return selenium.isElementPresent("button_Close");
  }
};
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用,driver.wait但它无法识别until命令或isElementPresent

Xol*_*.io 8

我直接在这里查看docs的源文件.它实际上非常好:

https://code.google.com/p/selenium/source/browse/javascript/webdriver/webdriver.js

在回答你的问题时,你真的不想在WebDriverJS中等待,你想要习惯延迟对象并承诺api.我刚刚写了一篇关于它的博客文章应该可以帮助你:

http://xolv.io/blog/2013/04/end-to-end-testing-for-web-apps-meteor