Why is webdriver not defined in my Protractor test case?

I am trying to use the method according to Document Handlers . but when i make the API call i get ReferenceError: webdriver is not defined

. This problem is the only one I could find, and this (rather strange) solution does not work in my case.

My code looks like this:

'Cookie': webdriver.WebDriver.Options.prototype.getCookie('CookieName')

      

I start the protractor version 1.4.0

.

+3


source to share


1 answer


Well, browser.manage()

it is a parameter interface for an instance webdriver.WebDriver.Options

.

Please do the following:

browser.manage().getCookie('CookieName');

      

Sorry the docs are confusing on this one.



Also, follow the promise to get the actual value:

browser.manage().getCookie('CookieName').then(function(cookieValue) {
    console.log(cookieValue);
});

      

If you don't expect, in which case it will resolve for you:

expect(browser.manage().getCookie('CookieName')).toEqual('some value');

      

+3


source







All Articles