From: Vinay M. <vin...@gm...> - 2005-02-02 08:00:48
|
Hi, I am using HtmlUnit to fill up a page that pops up javascript alerts when certain buttons are clicked or when a textbox loses focus. I need to be able to capture these alerts and fetch the messages conveyed therein. Is there a way to check for these alerts in an asynchronous manner ? In the sense, is there anything else that I can do apart from : 1) designating an instance of "CollectingAlertHandler" to maintain a list of alerts that might show up on a page 2) and then, keep checking if the list of alerts in CollectingAlertHandler got populated everytime I enter a value on the site ? Basically, I am looking for an "event listener" that gets notified whenever an alert shows up on a page. The "event listener" could then delegate the handling of the event to an appropriate "event handler". Does HtmlUnit support this kind of a feature ? Does popping up of an alert qualify as a WebWindowEvent, so that I could use a handler implementing WebWindowListener ? Thanks and Best Regards Vinay Murthy |
From: Mike B. <mb...@Ga...> - 2005-02-02 12:30:17
|
Vinay Murthy wrote: >Basically, I am looking for an "event listener" that gets notified >whenever an alert shows up on a page. The "event listener" could then >delegate the handling of the event to an appropriate "event handler". > > That's what the AlertHandler interface is there for. CollectingAlertHandler is just one implementation but you could easily write your own. Look at WebClient.setAlertHandler(); -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Sridhar R. <Sri...@Su...> - 2005-03-28 15:53:54
|
Hi, I have a Radio button group with 2 buttons. Both have same element ID and name. But the value changes depending on which button was clicked. Moreover, the attributes (enable/disable) changes for some elements in the page depending on which radio button is clicked. Right now, I am setting the value attribute for the radio element. However, by this method, I am not able to refresh the page. What I want to do is to click the radio button using click() and then I could get the HtmlPage content to verify the enable/disable for other fields. Is there any way I can achieve this ? thanks -- Sridhar R |
From: David D.K. <ddk...@ki...> - 2005-03-29 04:48:56
|
You need to get a reference to the Java object representing the radio button (DOM object), then call the click() method on it. That should invoke the appropriate JavaScript to mimic what the web browser does. Use the HtmlPage object to get a reference to the appropriate HtmlRadioButtonInput object. Dave On Mar 28, 2005, at 9:53 AM, Sridhar Ranganathan wrote: > Hi, > > I have a Radio button group with 2 buttons. Both have same element ID > and name. But the value changes depending on which button was clicked. > Moreover, the attributes (enable/disable) changes for some elements in > the page depending on which radio button is clicked. > > Right now, I am setting the value attribute for the radio element. > However, by this method, I am not able to refresh the page. What I want > to do is to click the radio button using click() and then I could get > the HtmlPage content to verify the enable/disable for other fields. > > Is there any way I can achieve this ? > > thanks > -- > Sridhar R |
From: Sridhar R. <Sri...@Su...> - 2005-02-15 21:34:01
|
Hi, Is there any way to click the drop-down option using the caption displayed ? I have a drop-down with options like : <option class="MnuJmpOpt" value="0">— Operations —</option> <option class="MnuJmpOptDis" value="8" disabled="disabled">Create </option> <option class="MnuJmpOptDis" value="6" disabled="disabled">Modify</option> <option class="MnuJmpOptDis" value="1" disabled="disabled">Delete</option> <option class="MnuJmpOptDis" value="2" disabled="disabled">Settings</option> Currently, I am choosing using the value like "1" or "2" etc., Is there any way to choose using "Create" / "Modify" - which the user sees on the screen. thanks Sridhar |
From: Brad C. <yo...@br...> - 2005-02-15 21:44:01
|
I put my method on a wiki page for you: http://htmlunit.sourceforge.net/phpwiki/index.php/SelectOptionByText --- Sridhar Ranganathan <Sri...@Su...> wrote: > > Hi, > > Is there any way to click the drop-down option using the caption displayed ? > > > I have a drop-down with options like : > > <option class="MnuJmpOpt" value="0"> Operations </option> > <option class="MnuJmpOptDis" value="8" disabled="disabled">Create </option> > <option class="MnuJmpOptDis" value="6" disabled="disabled">Modify</option> > <option class="MnuJmpOptDis" value="1" disabled="disabled">Delete</option> > <option class="MnuJmpOptDis" value="2" disabled="disabled">Settings</option> > > > Currently, I am choosing using the value like "1" or "2" etc., Is there > any way to choose using "Create" / "Modify" - which the user sees on the > screen. > > thanks > Sridhar |
From: Sridhar R. <Sri...@Su...> - 2005-02-15 22:05:24
|
Thanks.. :) Brad Clarke wrote: > I put my method on a wiki page for you: >=20 > http://htmlunit.sourceforge.net/phpwiki/index.php/SelectOptionByTex= t >=20 >=20 > --- Sridhar Ranganathan <Sri...@Su...> wrote: >=20 >=20 >>Hi, >> >>Is there any way to click the drop-down option using the caption di= splayed ? >> >> >>I have a drop-down with options like : >> >><option class=3D"MnuJmpOpt" value=3D"0">=97 Operations =97</option> >><option class=3D"MnuJmpOptDis" value=3D"8" disabled=3D"disabled">Cr= eate </option> >><option class=3D"MnuJmpOptDis" value=3D"6" disabled=3D"disabled">Mo= dify</option> >><option class=3D"MnuJmpOptDis" value=3D"1" disabled=3D"disabled">De= lete</option> >><option class=3D"MnuJmpOptDis" value=3D"2" disabled=3D"disabled">Se= ttings</option> >> >> >>Currently, I am choosing using the value like "1" or "2" etc., Is t= here >>any way to choose using "Create" / "Modify" - which the user sees o= n the >>screen. >> >>thanks >>Sridhar >=20 >=20 >=20 >=20 > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real u= sers. > Discover which products truly live up to the hype. Start reading no= w. > http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user --=20 Sridhar R |