Skip to content

Calling driver.switchTo().frame causes java.lang.StringIndexOutOfBoundsException #103

@Apxdono

Description

@Apxdono

When trying to switch to frame using opera driver implementation i constantly get 'java.lang.StringIndexOutOfBoundsException: String index out of range: -1' at 'com.opera.core.systems.scope.stp.services.ScopeEcmascriptService'. The method ' framePathToIndex(String framePath)' tries to extract the index between square brackets from framePath value ( which is usually something like "frameName[index]" ). But sometimes the value, that is passed to this method has no brackets at all which causes the problem.

Code to reproduce:
@test
public void frameTest() {
WebDriver driver = new OperaDriver();
driver.get("http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_multiple");
driver.switchTo().frame("iframeResult");
WebElement we = driver.findElement(By.tagName("select"));
LOG.info(we.getTagName());
LOG.info(we.getAttribute("multiple"));
driver.switchTo().defaultContent();
WebElement body = driver.findElement(By.id("result"));
LOG.info(body.getTagName());
driver.quit();
}

Sys info:
windows 7 x64
opera version: 12.17 build 1863 for x32 platforms (and a couple of older versions)
java 1.7.0_51 x64

selenium-java versions tested 2.37.0 - 2.42.0
opera-driver version 1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions