Here is some code from an angularjs e2e test.
expect(browser().location().url()).toBe('/phones');
Protractor gives this error.
TypeError: Property 'browser' of object # is not a function
In particular, how can I change the line to fix the protractor error? In general, where can I find docs on the webdriverjs browser object?
You can use:
//using full URL
expect(browser.getCurrentUrl()).toEqual('http://host:port/your/url/phones');
//or using baseUrl
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + '/phones');
You can find the API here.
And this is what I got when using console.log(browser);
:
{ controlFlow: [Function],
schedule: [Function],
getSession: [Function],
getCapabilities: [Function],
getCapability: [Function],
quit: [Function],
actions: [Function],
executeScript: [Function],
executeAsyncScript: [Function],
call: [Function],
wait: [Function],
sleep: [Function],
getWindowHandle: [Function],
getAllWindowHandles: [Function],
getPageSource: [Function],
close: [Function],
getCurrentUrl: [Function],
getTitle: [Function],
findDomElement_: [Function],
takeScreenshot: [Function],
manage: [Function],
navigate: [Function],
switchTo: [Function],
driver:
{ session_:
{ then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] },
executor_: { execute: [Function] },
flow_:
{ events_: {},
timer: [Object],
history_: [],
activeFrame_: [Object],
schedulingFrame_: [Object],
eventLoopId_: [Object] } },
element: { [Function] all: [Function] },
'$': [Function],
'$$': [Function],
baseUrl: 'http://localhost:8000',
rootEl: 'body',
ignoreSynchronization: false,
params: {},
moduleNames_: [],
moduleScripts_: [] }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With