Skip to content

Commit ca75910

Browse files
committed
Fixed switchToIframe by xpath
after previous fix
1 parent 7e6de3f commit ca75910

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Codeception/Module/WebDriver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2547,11 +2547,14 @@ public function switchToIFrame($locator = null)
25472547
try {
25482548
$els = $this->_findElements("iframe[name='$locator']");
25492549
} catch (\Exception $e) {
2550+
$this->debug('Failed to find locator by name: ' . $e->getMessage());
2551+
}
2552+
if (!is_array($els) || !count($els)) {
25502553
$this->debug('Iframe was not found by name, locating iframe by CSS or XPath');
25512554
$els = $this->_findElements($locator);
25522555
}
25532556
if (!count($els)) {
2554-
throw new ElementNotFound($selector, "Iframe was not found by CSS or XPath");
2557+
throw new ElementNotFound($locator, 'Iframe');
25552558
}
25562559
$this->webDriver->switchTo()->frame($els[0]);
25572560
}

0 commit comments

Comments
 (0)