Есть ли способ в Intern, который я могу опрашивать, пока элемент не станет видимым? Многие элементы на моем веб-сайте находятся в dom, но скрыты, поэтому каждый раз, когда я выполняю «поиск» элемента X после того, как он должен появиться, он терпит неудачу, потому что элемент явно нарушает один из видимых атрибутов, которые проверяет селен.
Я пробовал вспомогательную функцию "pollUntil", но не могу заставить ее работать. Dojo, похоже, не нравится document.getElement*()
Вспомогательная функция, которая передается в pollUntil
//this is a helper function for pollUntil
//first we want to find an element by class name and text
var elementVisibleAndText = function(elems, innerText){
elems = document.getElementsByClassName(elems);
//if we can't even find it, we return null
//but if we do find it, we want to return a
//not null element
if (!elems || elems.length == 0){
return null;
}
//now let's look at all of the elements found by
//in elems, and see if the innerHTML matches. If it
//does then we want to return that it was found
var each;
for(each in elems){
if(elems[each].innerHTML == innerText)
return (elems[each].offsetWidth > 0 && elems[each].offsetHeight > 0) ? elems[each] : null;
}
//else return null if nothing is found in the elements
return null;
};