SetInputField error String index out of range: -1000000

View: New views
2 Messages — Rating Filter:   Alert me  

SetInputField error String index out of range: -1000000

by Rhee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all

I get error StringIndexOutOfBoundsException: String index out of range: -1000000 when trying to set input to datagrid; see snippet below. Has anybody come across this error? My id and name for xpath are the same and they are really long (auto generated).

I am currently using
//*[@name= 'ctl00$ContentPlaceHolder1$grdExpenseEntry$grdExpenseEntry$ctl02$txtMonday']"
(verify passes but setInputField fails)

and have tried the 2 expressions below for short and both fail.
//*[ends-with(name(), 'Monday')]
//*[substring(name(),string-length(name())-1) = 'Monday']

Any suggestions are welcome.



<table class="GridView_Office2007" cellspacing="0" rules="all" border="1" id="ctl00_ContentPlaceHolder1_grdHourlyEntry_grdHourlyEntry" style="border-collapse:collapse;">
                                    <tr>
                                        <th scope="col">&nbsp;</th><th scope="col">                    <span id="ctl00_ContentPlaceHolder1_grdHourlyEntry_grdHourlyEntry_ctl01_lblMondayHeader">Mon</span>
                    <br />



java.lang.StringIndexOutOfBoundsException: String index out of range: -1000000 at java.lang.String.substring(String.java:1938) at com.gargoylesoftware.htmlunit.html.DoTypeProcessor.doType(DoTypeProcessor.java:40) at com.gargoylesoftware.htmlunit.html.HtmlTextInput.doType(HtmlTextInput.java:69) at com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:477) at com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:444) at com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:413) at com.canoo.webtest.steps.form.SetInputField.setField(SetInputField.java:62) at com.canoo.webtest.steps.form.AbstractSetFieldStep.doExecute(AbstractSetFieldStep.java:151)

(R_1781)/ htmlunit-2.7.jar

Thanks
--
- Rhee

"Risk nothing and you gain nothing"

Re: SetInputField error String index out of range: -1000000

by Marc Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rhee,

this looks like a bug in HtmlUnit. Can you provide a minimal test case
allowing to reproduce the problem?

Cheers,
Marc.

Rhee a écrit :

> Hi all
>
> I get error StringIndexOutOfBoundsException: String index out of range:
> -1000000 when trying to set input to datagrid; see snippet below. Has
> anybody come across this error? My id and name for xpath are the same
> and they are really long (auto generated).
>
> I am currently using
> //*[@name=
> 'ctl00$ContentPlaceHolder1$grdExpenseEntry$grdExpenseEntry$ctl02$txtMonday']"
>
> (verify passes but setInputField fails)
>
> and have tried the 2 expressions below for short and both fail.
> //*[ends-with(name(), 'Monday')]
> //*[substring(name(),string-length(name())-1) = 'Monday']
>
> Any suggestions are welcome.
>
>
>
> <table class="GridView_Office2007" cellspacing="0" rules="all"
> border="1" id="ctl00_ContentPlaceHolder1_grdHourlyEntry_grdHourlyEntry"
> style="border-collapse:collapse;">
>                                     <tr>
>                                         <th scope="col"> </th><th
> scope="col">                    <span
> id="ctl00_ContentPlaceHolder1_grdHourlyEntry_grdHourlyEntry_ctl01_lblMondayHeader">Mon</span>
>                     <br />
>
>
>
> java.lang.StringIndexOutOfBoundsException: String index out of range:
> -1000000 at java.lang.String.substring(String.java:1938) at
> com.gargoylesoftware.htmlunit.html.DoTypeProcessor.doType(DoTypeProcessor.java:40)
> at
> com.gargoylesoftware.htmlunit.html.HtmlTextInput.doType(HtmlTextInput.java:69)
> at
> com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:477)
> at
> com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:444)
> at
> com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:413)
> at
> com.canoo.webtest.steps.form.SetInputField.setField(SetInputField.java:62)
> at
> com.canoo.webtest.steps.form.AbstractSetFieldStep.doExecute(AbstractSetFieldStep.java:151)
>
>
> (R_1781)/ htmlunit-2.7.jar
>
> Thanks
> --
> - Rhee
>
> "Risk nothing and you gain nothing"

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest