sendKeys() fails with start > length()
See original GitHub issuesendKeys()
method fails with StringIndexOutOfBoundsException: start > length()
:
java.lang.RuntimeException:
at org.robotframework.javalib.library.AnnotationLibrary.retrieveInnerException(AnnotationLibrary.java:148)
at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:130)
at robot.model.testcase$py.visit$7(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testcase.py:74)
at robot.model.testcase$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testcase.py)
at robot.model.itemlist$py.visit$11(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py:71)
at robot.model.itemlist$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py)
at robot.model.visitor$py.visit_suite$2(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py:88)
at robot.model.visitor$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py)
at robot.model.testsuite$py.visit$19(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py:168)
at robot.model.testsuite$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py)
at robot.model.itemlist$py.visit$11(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py:71)
at robot.model.itemlist$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py)
at robot.model.visitor$py.visit_suite$2(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py:88)
at robot.model.visitor$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py)
at robot.model.testsuite$py.visit$19(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py:168)
at robot.model.testsuite$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py)
at robot.model.itemlist$py.visit$11(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py:71)
at robot.model.itemlist$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py)
at robot.model.visitor$py.visit_suite$2(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py:88)
at robot.model.visitor$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py)
at robot.model.testsuite$py.visit$19(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py:168)
at robot.model.testsuite$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py)
at robot.model.itemlist$py.visit$11(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py:71)
at robot.model.itemlist$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py)
at robot.model.visitor$py.visit_suite$2(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py:88)
at robot.model.visitor$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py)
at robot.model.testsuite$py.visit$19(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py:168)
at robot.model.testsuite$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py)
at robot.model.itemlist$py.visit$11(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py:71)
at robot.model.itemlist$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\itemlist.py)
at robot.model.visitor$py.visit_suite$2(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py:88)
at robot.model.visitor$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\visitor.py)
at robot.model.testsuite$py.visit$19(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py:168)
at robot.model.testsuite$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\model\testsuite.py)
at robot.run$py.main$3(C:\Users\hifi\git\robotframework\build\Lib\robot\run.py:448)
at robot.run$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\run.py)
at robot.utils.application$py._execute$10(C:\Users\hifi\git\robotframework\build\Lib\robot\utils\application.py:94)
at robot.utils.application$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\utils\application.py)
at robot.utils.application$py.execute_cli$5(C:\Users\hifi\git\robotframework\build\Lib\robot\utils\application.py:49)
at robot.utils.application$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\utils\application.py)
at robot.run$py.run_cli$7(C:\Users\hifi\git\robotframework\build\Lib\robot\run.py:488)
at robot.run$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\run.py)
at robot.jarrunner$py._run$3(C:\Users\hifi\git\robotframework\build\Lib\robot\jarrunner.py:64)
at robot.jarrunner$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\jarrunner.py)
at robot.jarrunner$py.run$2(C:\Users\hifi\git\robotframework\build\Lib\robot\jarrunner.py:57)
at robot.jarrunner$py.call_function(C:\Users\hifi\git\robotframework\build\Lib\robot\jarrunner.py)
at org.robotframework.RobotRunner.run(RobotRunner.java:74)
at org.robotframework.RobotFramework.run(RobotFramework.java:61)
at org.robotframework.mavenplugin.AcceptanceTestMojo.executeRobot(AcceptanceTestMojo.java:73)
at org.robotframework.mavenplugin.AcceptanceTestMojo.subclassExecute(AcceptanceTestMojo.java:68)
at org.robotframework.mavenplugin.AbstractMojoWithLoadedClasspath.execute(AbstractMojoWithLoadedClasspath.java:53)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)
Caused by: java.lang.StringIndexOutOfBoundsException: start > length()
at java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:853)
at java.lang.StringBuilder.replace(StringBuilder.java:262)
at com.gargoylesoftware.htmlunit.html.DoTypeProcessor.add(DoTypeProcessor.java:138)
at com.gargoylesoftware.htmlunit.html.DoTypeProcessor.doType(DoTypeProcessor.java:123)
at com.gargoylesoftware.htmlunit.html.HtmlUrlInput.doType(HtmlUrlInput.java:138)
at com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:551)
at com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:648)
at org.openqa.selenium.htmlunit.HtmlUnitKeyboard.sendKeys(HtmlUnitKeyboard.java:89)
at org.openqa.selenium.htmlunit.HtmlUnitKeyboard.sendKeys(HtmlUnitKeyboard.java:58)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$sendKeys$7(HtmlUnitDriver.java:487)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$runAsync$0(HtmlUnitDriver.java:438)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
It happens with <input type="url">
in my case. It only reproducible when another test typed a value into this field and submitted a form. But as the form is React component, it seems like htmlunit holds some state between tests and it doesn’t invalidate it because a form is submitted by JavaScript code.
Verisons:
- htmlunit 2.37.0
- htmlunit-driver 2.37.0
- selenium 3.141.59
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Selenium sendKeys are not sending all characters
I was getting this error too in Java, Selenium. ... getAttribute("value"); if (inputValueAfterTyping.length() > i + 1) { // Alternatively: ...
Read more >Send Keys command doesnt work for long strings(paragraghs)
I am trying to copy and paste JSON data to a third party JSON viewer site,I am using getText and SendKeys for that,getText...
Read more >Selenium SendKeys : All You Need To Know - LambdaTest
In this article, we'll delve into how Selenium helps us pass values to text fields using the Selenium sendKeys() method. Let us start...
Read more >Setting up your own test automation environment
In this case we get the title of the current page with the getTitle() method, then return a pass or fail message depending...
Read more >Implicit and Explicit Wait in Selenium WebDriver (Types of ...
Let us discuss a few of them at length: #1) elementToBeClickable() – The expected condition waits for an element to be clickable i.e....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok, this has two parts
The first part is fixed and will be in the next snapshot.
The second part will be released with the next HtmlUnit driver version.
Should be fixed now in HtmlUnit Driver also. Hope to make the release available tomorrow.