Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium WebDriverJs commands

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?

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");
  }
};

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

like image 651
Dan Avatar asked Mar 19 '13 17:03

Dan


People also ask

What are the three types of Selenium commands?

Types of Selenium Commands Selenium commands are basically classified in three categories: Actions. Accessors. Assertions.

What are action commands in Selenium?

Actions class is an ability provided by Selenium for handling keyboard and mouse events. In Selenium WebDriver, handling these events includes operations such as drag and drop, clicking on multiple elements with the control key, among others. These operations are performed using the advanced user interactions API.


1 Answers

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

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/end-to-end-testing-for-web-apps-meteor

like image 95
Xolv.io Avatar answered Nov 08 '22 03:11

Xolv.io