Skip to content

Commit f43e001

Browse files
committed
DEBUG test createMinkElementFromWebDriverElement method for all elems
1 parent a9e416b commit f43e001

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/Selenium2Driver.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)