Objeto del navegador Convertir AngularJS E2E PRUEBA PARA PROTRACTOR
-
23-12-2019 - |
Pregunta
Aquí hay algún código de una prueba E2E de AngularJS.
expect(browser().location().url()).toBe('/phones');
protractor da este error.
TypeError: el "navegador 'de la propiedad' de objeto # no es una función
En particular, ¿cómo puedo cambiar la línea para solucionar el error del protractor? En general, ¿dónde puedo encontrar documentos en el objeto del navegador webdriverjs?
Solución
puedes usar:
//using full URL
expect(browser.getCurrentUrl()).toEqual('http://host:port/your/url/phones');
//or using baseUrl
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + '/phones');
Puede encontrar la api aquí .
y esto es lo que obtuve cuando usas 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_: [] }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow