File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -304,7 +304,7 @@ protected function createMinkElementFromWebDriverElement(Element $element)
304304
305305 // DEBUG only
306306 if ($ this ->findElement ($ minkElement ->getXpath ())->getID () !== $ element ->getId ()) {
307- throw new DriverException (sprintf ('XPath "%s" built from WebDriver element cannot find the same element ' , $ xpath ));
307+ throw new \ Error (sprintf ('XPath "%s" built from WebDriver element cannot find the same element ' , $ xpath ));
308308 }
309309
310310 return $ minkElement ;
@@ -627,6 +627,22 @@ public function findElementXpaths($xpath)
627627 $ elements [] = sprintf ('(%s)[%d] ' , $ xpath , $ i +1 );
628628 }
629629
630+ // DEBUG only
631+ $ recursiveCount = 0 ;
632+ foreach (debug_backtrace () as $ trace ) {
633+ if (($ trace ['function ' ] ?? null ) === __FUNCTION__ ) {
634+ $ recursive = $ recursiveCount ++;
635+ }
636+ }
637+ if ($ recursiveCount <= 4 ) {
638+ foreach ($ nodes as $ element ) {
639+ $ minkElement = $ this ->createMinkElementFromWebDriverElement ($ element );
640+ if ($ this ->findElement ($ minkElement ->getXpath ())->getID () !== $ element ->getId ()) {
641+ throw new \Error (sprintf ('XPath "%s" built from WebDriver element cannot find the same element (in find) ' , $ xpath ));
642+ }
643+ }
644+ }
645+
630646 return $ elements ;
631647 }
632648
You can’t perform that action at this time.
0 commit comments