Unable to select options from the dynamically generated drop down(select list)

67 views
Skip to first unread message

Narendra Patil

unread,
Aug 10, 2011, 12:04:13 PM8/10/11
to watij, nsp...@gmail.com
HI All,

Currently I am testing one web application. There is one scenario
where:
1. I switch from graph view to table view
2. Select the no of rows using a drop down (e.g no of
rows=10/20/30/40)

- I was trying to simulate this using Watij. I am able to do this when
my machine is not locked. But whenever my machine is locked and I try
to run this scenario, then the watij does not select the options of
drop down,however it recognizes the drop down(I used assertions to
check presence of select list).
- This select list is created dynamically using jquery.

Html Code of select list:

<DIV style="DISPLAY: none" id=chart_body_17 class=chart-body
jQuery1312985390059="121">
--
--
<div id="pager17" class="pager">
<form>
<img class="first" src="/images/arrows/first.png">
<img class="prev" src="/images/arrows/prev.png">
<input class="pagedisplay" type="text" disabled="disabled">
<img class="next" src="/images/arrows/next.png">
<img class="last" src="/images/arrows/last.png">
<select class="pagesize">
<option value="10" selected="selected">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
</select>
</form>
</div>
</div>
</div>


Watij code I tried:

ie.bringToFront();
asserttrue(ie.htmlElement(id,"chart_body_17").htmlElement(id,"pager17").form(0).selectlist(0).exists());
ie.htmlElement(id,"chart_body_17").htmlElement(id,"pager17").form(0).selectlist(0).option(2).select();
ie.htmlElement(id,"chart_body_17").htmlElement(id,"pager17").form(0).selectlist(0).click();


The above watij code works when mavhine is unlocked but fails whenever
locked..One thing to remember here is is also tried it using
sendkey("{ENTER}") but failed ..

Can anyone please tell me whether this is an issue with watij..or my
code..?(Or whether it is issue with COM in windows.. )


Exceptions it give:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.jniwrapper.win32.ie.dom.j.run(SourceFile:592)
at com.jniwrapper.win32.MessageLoopThread
$ThreadSynchronizedAction.run(MessageLoopThread.java:569)
at com.jniwrapper.win32.MessageLoopThread
$LoopThread.run(MessageLoopThread.java:511)
Caused by: com.jniwrapper.win32.com.ComException: COM object method
returns error code: 0x80070057; E_INVALIDARG (The parameter is
incorrect.)
at
com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:
725)
at
com.jniwrapper.win32.mshtml.impl.IHTMLElement3Impl.fireEvent(SourceFile:
376)
at com.jniwrapper.win32.ie.dom.c.fireEvent(SourceFile:322)
at com.jniwrapper.win32.ie.dom.c.fireEvent(SourceFile:558)
... 7 more

Reply all
Reply to author
Forward
0 new messages