2014-02-27 12 views
6

Hier ist ein code von einem angularjs e2e test.browser objekt umwandeln angularjs e2e test zu winkelmesser

expect(browser().location().url()).toBe('/phones'); 

Winkelmesser gibt diesen Fehler.

TypeError: Property 'browser' of object # is not a function

Insbesondere, wie kann ich die Linie ändern, um den Winkelmesserfehler zu beheben? Wo finde ich im Allgemeinen Dokumente auf dem webdriverjs Browser-Objekt?

Antwort

8

können Sie verwenden:

//using full URL 
expect(browser.getCurrentUrl()).toEqual('http://host:port/your/url/phones'); 

//or using baseUrl 
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + '/phones'); 

Sie die API here finden.

Und das ist, was ich habe, wenn console.log(browser); mit:

{ 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_: [] } 
Verwandte Themen