这是来自angularjs e2e测试的一些代码。
expect(browser().location().url()).toBe('/phones');
量角器给出了这个错误。
TypeError:对象#的属性“浏览器”不是函数
特别是,如何更改线以修正量角器错误? 一般来说,我在哪里可以找到webdriverjs浏览器对象上的文档?
答案 0 :(得分:8)
您可以使用:
//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_: [] }