fix timing problem

This commit is contained in:
Marc Wäckerlin
2017-06-20 14:12:44 +00:00
parent 23240097ee
commit 706ef30b71
4 changed files with 5 additions and 6 deletions

View File

@@ -1508,16 +1508,16 @@ class Exists: public Command {
QString selector(script->replacevars(_selector));
QString text(script->replacevars(_text));
QStringList notfound;
QWebElement firstelement(find(frame, selector));
Q_FOREACH(QWebElement element, frame->findAllElements(selector)) {
if (text.isEmpty()) return true; // just find element
if (element.toOuterXml().indexOf(text)!=-1) return true;
if (element.toPlainText().indexOf(text)!=-1) return true;
notfound += element.toOuterXml();
}
QWebElement element(find(frame, selector));
if (text.isEmpty())
error(log, AssertionFailed("element not found: "+selector));
else if (element.isNull())
else if (firstelement.isNull())
error(log, AssertionFailed("expected \""+text+"\" in non existing element "
+selector));
else