3

I am trying to use a method as per the Protractor docs. but when I do the API call I get ReferenceError: webdriver is not defined. This issue is the only other occurence of this that I could find, and it's (rather odd) solution does not work in my case.

My code looks like:

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

I'm running protractor version 1.4.0.

Community
  • 1
  • 1
Aaron
  • 2,367
  • 3
  • 25
  • 33

1 Answers1

3

Well, browser.manage() is the options interface for the webdriver.WebDriver.Options instance.

Please do:

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

Sorry docs are confusing on this one.

Also, please follow the promise to get the actual value:

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

Unless you're doing an expectation in which case it will be resolved for you:

expect(browser.manage().getCookie('CookieName')).toEqual('some value');
Leo Gallucci
  • 16,355
  • 12
  • 77
  • 110
  • 1
    could you link to the api docs? I can't find the functions that you mention here... –  Feb 01 '15 at 23:31