I am relatively new with WebDriver. I have a webape for which I am
trying to write a test. The webpage is a form that has two fields a
hidden field and a text area that allows the user to enter an email
address. The form has an onsubmit attribute that calls a javascript
method. The javascript method copies the email address to the hidden
field.
I tried both HtmlUnit (with javascript enabled) and the Firefox
drivers and it seems that the hidden field does not get populated when
I run the test with webdriver. When I type it in on firefox, hidden
field gets populated.
Any ideas as to why this is happening?
Thanks,
--
Theo
Could you post your test code, and if possible the HTML and javascript
you're testing against?
WebElement textField = driver.findElement(By.id("foo"));
textField.sendKeys("cheese");
textField.submit();
Regards,
Simon
On Mon, Dec 28, 2009 at 11:29 PM, Theo <ther...@gmail.com> wrote:
> --
>
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
The form in question had an input field of type "image", my test code
was calling `submit()' on a different element. That seems to cause the
from submission but without any events that would trigger the script
specified with the `onsubmit' attribute.
If my reasoning here is wrong please let me know, I now have a pretty
trimmed down version of the page and code and how to reproduce the
behavior.
Thanks.
--
Theo
On Dec 29, 5:25 am, Simon Stewart <simon.m.stew...@gmail.com> wrote:
> I suspect that your hidden field gets updated when the focus shifts
> from the textfield. If that's the case, then you may not see the
> expected behaviour when calling the "submit" method (though you
> should) Does your test look a little like this?
>
> WebElement textField = driver.findElement(By.id("foo"));
> textField.sendKeys("cheese");
> textField.submit();
>
> Regards,
>
> Simon
>
-- Jason
I will fix this in the next few days :)
Thanks
--
Theo