@@ -63,12 +63,13 @@ public function waitForPwaElementNotVisible($selector, $timeout = null)
63
63
64
64
// Determine what type of Selector is used.
65
65
// Then use the correct JavaScript to locate the Element.
66
- if (\Codeception \Util \Locator::isXPath ($ selector )) {
66
+ if (\Codeception \Util \Locator::isCss ($ selector )) {
67
67
$ this ->waitForLoadingMaskToDisappear ($ timeout );
68
- $ this ->waitForJS ("return !document.evaluate (` $ selector`, document ); " , $ timeout );
68
+ $ this ->waitForJS ("return !document.querySelector (` $ selector`); " , $ timeout );
69
69
} else {
70
70
$ this ->waitForLoadingMaskToDisappear ($ timeout );
71
- $ this ->waitForJS ("return !document.querySelector(` $ selector`); " , $ timeout );
71
+ $ this ->waitForJS ("return !document.evaluate(` $ selector`, document, null,
72
+ XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; " , $ timeout );
72
73
}
73
74
}
74
75
@@ -84,15 +85,16 @@ public function waitForPwaElementNotVisible($selector, $timeout = null)
84
85
public function waitForPwaElementVisible ($ selector , $ timeout = null )
85
86
{
86
87
$ timeout = $ timeout ?? $ this ->_getConfig ()['pageload_timeout ' ];
87
-
88
+
88
89
// Determine what type of Selector is used.
89
90
// Then use the correct JavaScript to locate the Element.
90
- if (\Codeception \Util \Locator::isXPath ($ selector )) {
91
+ if (\Codeception \Util \Locator::isCss ($ selector )) {
91
92
$ this ->waitForLoadingMaskToDisappear ($ timeout );
92
- $ this ->waitForJS ("return !!document && !!document.evaluate (` $ selector`, document ); " , $ timeout );
93
+ $ this ->waitForJS ("return !!document && !!document.querySelector (` $ selector`); " , $ timeout );
93
94
} else {
94
95
$ this ->waitForLoadingMaskToDisappear ($ timeout );
95
- $ this ->waitForJS ("return !!document && !!document.querySelector(` $ selector`); " , $ timeout );
96
+ $ this ->waitForJS ("return !!document && !!document.evaluate(` $ selector`, document, null,
97
+ XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; " , $ timeout );
96
98
}
97
99
}
98
100
}
0 commit comments