Selenium WebDriverJs命令 [英] Selenium WebDriverJs commands

查看:67
本文介绍了Selenium WebDriverJs命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次运行Node.js + Mocha + Selenium Webdriverjs的组合.我会根据他们的文档在这里 https://code.google.com/p/selenium/wiki/WebDriverJs ,但我发现实际上很难找到可通过Web驱动程序获得的所有命令的列表.使用Selenium webdriverjs编写测试时,有可用的命令列表吗?

I am running a combination of Node.js + Mocha + Selenium Webdriverjs for the first time. I setup everything according to their documentation here https://code.google.com/p/selenium/wiki/WebDriverJs, but I find it very difficult to actually find a list of all the commands available via the web driver. Is there a list of commands that are available to use when writing tests using Selenium webdriverjs?

例如,我将如何使用Javascript实现以下Java代码

For example how would I achieve the below java code using Javascript

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

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

I know I can use driver.wait but it doesn't recognize the until command or the isElementPresent

推荐答案

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

I look here directly at the source file for docs. It's actually pretty good:

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

为回答您的问题,您真的不想在WebDriverJS中等待,您希望习惯于延迟对象并答应api.我刚刚在这里写了一篇有关它的博客文章,该文章应该会对您有所帮助:

In answer to your question, you don't really want to wait in WebDriverJS, you want to get used to the deferred objects and promises api. I've just written a blog post about it here that should help you:

http://xolv. io/blog/2013/04/web-apps流星的端到端测试

这篇关于Selenium WebDriverJs命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆