Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programatically access the current webdriver instance?

I'm writing an e2e test suite using Protractor.

I know it's built on top of WebdriverJS, and I'm trying to using some webdriverJS functionality.

Namely, I'm trying to enqueue some behavior using the webdriverJS' promise manager, and the WebdriverJS documentation says I should use

webdriver.promise.controlFlow().execute(function myBehavior(){...});

Trouble is, I don't know how to access that "webdriver" object. There is no global variable named "webdriver".

Can someone help me on this?

EDIT:

Now that the question has been solved, I'd like to highlight the fact that one must use

browser.driver.controlFlow()

and not

browser.driver.promise.controlFlow()

despite what WebdriverJS documentation may suggest.

like image 977
Valentin Waeselynck Avatar asked Apr 14 '14 13:04

Valentin Waeselynck


1 Answers

The documentation says browser.driver is the underlying webdriver.

So can you try this:

browser.driver.controlFlow().execute(function myBehavior(){...});
like image 171
Lajos Veres Avatar answered Sep 30 '22 18:09

Lajos Veres