Transportador esperando que el elemento esté en DOM
He estado teniendo algunos problemas con el transportador. Tengo un estado de iu-router muy raro donde es difícil salir de otros elementos para empezar a trabajar con la página. ¿Hay alguna manera de decirle al transportador que espere hasta que finalmente aparezca un elemento en el DOM? No visible / mostrado, pero realmente creado? Sigo intentando usar wait for the element pero claramente no está disponible para ser seleccionado.
browser.driver.wait(function () {
return elem.isDisplayed();
});
3 answers
Debería ser capaz de utilizar browser.wait
junto con el presenceOf
ExpectedCondition:
var until = protractor.ExpectedConditions;
browser.wait(until.presenceOf(elem), 5000, 'Element taking too long to appear in the DOM');
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-05 07:19:16
Protractor ha incluido ExpectedCondition para una espera explícita que le permite esperar al elemento durante cierto período de tiempo. Usted debe ser capaz de hacer lo siguiente
var EC = protractor.ExpectedConditions;
browser.driver.wait(function () {
browser.wait(EC.visibilityOf(elem), 10000);
return elem;
});
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-13 12:09:58
El primer parámetro del navegador.wait es una función, si necesitamos esperar hasta que un elemento esté presente independientemente del tiempo, entonces podemos usar el siguiente código, Si necesita restringir la espera a un tiempo en particular, por favor, dé tiempo como segundo parámetro de 'browser.espera '
browser.wait(function() {
return element(by.css("#edudrop1")).isPresent()});
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-24 10:07:05