Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webdriverjs callbacks should follow the nodejs callback convention #46

Closed
mreinstein opened this issue Mar 9, 2013 · 4 comments
Closed

Comments

@mreinstein
Copy link

http://docs.nodejitsu.com/articles/getting-started/control-flow/what-are-callbacks

The general idea is that the callback is the last parameter. The callback gets called after the function
 is done with all of its operations. Traditionally, the first parameter of the callback is the error value. If
 the function hits an error, then they typically call the callback with the first parameter being an Error 
object. If it cleanly exits, then they will call the callback with the first parameter being null and the rest
 being the return value(s).
christian-bromann added a commit to christian-bromann/webdriverjs that referenced this issue Apr 6, 2013
@christian-bromann
Copy link
Member

I've finally implemented this!

Now each callback gets two parameters. The first one is an error object which could look like this:

{
    status: 7,
    type: "NoSuchElement",
    orgStatusMessage: "An element could not be located on the page using the given search parameters."
}

If there is no error, this parameter is null. The second one is the normal result parameter.
You are also able to pass a callback to each function now. For commands like click (gets no result from the selenium driver) it has the advantage that you are able to check if the command was successful.

@tunix
Copy link

tunix commented Apr 8, 2013

@christian-bromann - When is the new release? 👍

@christian-bromann
Copy link
Member

@tunix probably this or next week

@tunix
Copy link

tunix commented Apr 8, 2013

@christian-bromann - wohoo! :) great news, thanks!

christian-bromann pushed a commit that referenced this issue Aug 24, 2018
* port selectBy* commands

* selectBy* refactoring

* selectBy* refactoring

* update jsdoc

* update jsdoc

* more tests

* refactoring

* add more tests

* fix typo

* remove selectByValue command

* code review fixes
yamkay pushed a commit to MoveInc/webdriverio that referenced this issue Sep 4, 2019
* port selectBy* commands

* selectBy* refactoring

* selectBy* refactoring

* update jsdoc

* update jsdoc

* more tests

* refactoring

* add more tests

* fix typo

* remove selectByValue command

* code review fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants