Skip to content

Commit

Permalink
added nested frame depth limit. (max depth is 16) (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmi committed Feb 2, 2020
1 parent 177b421 commit 44c51d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions RELEASENOTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Selenese Runner Java Relase Note
### 3.29.0

* Don't take screenshots with assert* and `selectFrame` commands. (#315, #316)
* Add nested frame depth limit. (max depth is 16) (#311)
* Update dependency versions.

### 3.28.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class WebDriverElementFinder {

private static final int MIN_TIMEOUT = 3000; // ms
private static final long RETRY_INTERVAL = 100; // ms
private static final int MAX_FRAME_DEPTH = 16;

private static final Logger log = LoggerFactory.getLogger(WebDriverElementFinder.class);

Expand Down Expand Up @@ -211,6 +212,10 @@ private List<WebElement> findElementsByLocator(LocatorHandler handler, WebDriver
List<WebElement> result = handler.handle(driver, ploc.arg);
if (!result.isEmpty())
return result;
if (ploc.frameIndexList.size() >= MAX_FRAME_DEPTH) {
log.warn("Nested (i)frame depth exceeded limit: " + MAX_FRAME_DEPTH);
return null;
}
int iframeCount = driver.findElements(By.tagName("iframe")).size();
for (int index = 0; index < iframeCount; index++) {
pushFrame(driver, ploc, index);
Expand Down

0 comments on commit 44c51d2

Please sign in to comment.