您可以使用:
//using full URL
expect(browser.getCurrentUrl()).toEqual('http://host:port/your/url/phones');
//or using baseUrl
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + '/phones');
您可以找到API here。
而這就是我使用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_: [] }