Can't find the UI input object

46 views
Skip to first unread message

KillerTom

unread,
Jul 8, 2010, 5:10:12 AM7/8/10
to watij
Hi
I try the statement as below:

Spec spec = new Spec().mozilla();
spec.open("http://www.w3schools.com/js/tryit.asp?
filename=try_dom_text_name");
spec.pauseUntilReady();
spec.find("input").with("name=='email'").with("id=='email'").with("type='text'").set("value='st'");

But it always get the exception:Expectation failed: Element should
exist before calling value='st'
Do you know what wrong is?
Thanks
Tom

KillerTom

unread,
Jul 9, 2010, 5:06:53 AM7/9/10
to watij
Another problem, when i test on firefox,it works fine.But it can'g
work on IE.
Even through i use the spec.find("*").all().set("value='st'"); It
still can't find the element and prompt the exception as below:
Exception in thread "main" java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:417)
at java.lang.Integer.valueOf(Integer.java:554)
at org.watij.webspec.dsl.Tag.length(Tag.java:28)
at org.watij.webspec.dsl.All.length(All.java:13)
at org.watij.webspec.dsl.All.set(All.java:25)
at test.LoginHome1(test.java:19)
at test.main(test.java:37)


On Jul 8, 5:10 pm, KillerTom <killerto...@sina.com> wrote:
> Hi
> I try the statement as below:
>
> Spec spec = new Spec().mozilla();
> spec.open("http://www.w3schools.com/js/tryit.asp?
> filename=try_dom_text_name");
> spec.pauseUntilReady();
> spec.find("input").with("name=='email'").with("id=='email'").with("type='te­xt'").set("value='st'");

Brian Knorr

unread,
Jul 11, 2010, 8:18:51 PM7/11/10
to wa...@googlegroups.com
I think you want:

with("type=='text'")

and not:

with("type='text'")

Also find("*") is not supported...you basically asked for the tag called "*"....which doesn't exist.  WebSpec requires you to name the tag like "input", "div", "textarea", etc...this is for performance reasons.



--
You received this message because you are subscribed to the Google Groups "watij" group.
To post to this group, send email to wa...@googlegroups.com.
To unsubscribe from this group, send email to watij+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/watij?hl=en.




--
Brian Knorr
Dallas, Texas
http://www.starterstep.com

KillerTom

unread,
Jul 11, 2010, 9:51:23 PM7/11/10
to watij
I changed it to spec.find("input").all().set("value='st'");
My concern is our company's application works fine on firefox,but it
can't work on IE.It can't find any element on IE for our company's
application.
But it works fine for google on IE.So it is strange.
> > watij+un...@googlegroups.com <watij%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> >http://groups.google.com/group/watij?hl=en.
>
> --
> Brian Knorr
> Dallas, Texashttp://www.starterstep.com- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages