use getAlert( ) it will work.
--> Retrieves the message of a JavaScript alert generated during the
previous action, or fail if there were no alerts.--> --> Getting an
alert has the same effect as manually clicking 'OK' on alert pop up.
one more thing first u need to identify whether it is a "alert" or
"Confirmation".
Find the below clue also
alerts have the single button i.e OK, where as confirmations have two
optional buttons namely OK and Cancel.
I guess in your case instead using selenium click( locator ) use
fireEvent
void fireEvent(java.lang.String locator, java.lang.String eventName)
Explicitly simulate an event, to trigger the corresponding
"onevent" handler.
Parameters:
locator - an element locator
eventName - the event name, e.g. "focus" or "blur"
One more thing is, if you are having the link means, probably you
might be having the 'onClick' event and this case u have to use the
fireEvent as
fireEvent( String locator, "click");
Note: dont pass onclick in the method, just exclude the "on" for all
the events.
Regards,
Ranjith
On Jul 26, 12:17 pm, NagaRaju dasam <
nagaselen...@gmail.com> wrote:
> Thanks for the reply..The link you provided does not help me...
>
>
>
> On Mon, Jul 26, 2010 at 10:57 AM, Nusrat Nilofer <
nnilo...@gmail.com> wrote:
>
> > Selenium does NOT support JavaScript confirmations that are generated in a
> > page's onload() event handler. In this case a visible dialog WILL be
> > generated and Selenium will hang until you manually click OK.
>
> > try with soln given in
> >
http://qtp-help.blogspot.com/2009/07/selenium-handle-dialogs.html#han...
> > .
>
> > Regards,
>
> > Nusrat
>
> > On Mon, Jul 26, 2010 at 10:42 AM, NagaRaju dasam <
nagaselen...@gmail.com>wrote:
>
> >> Hi Guys,
>
> >> In my site when i click on a link i got a confirmation box. that
> >> confirmation box is on load event. i used all the possible commands like
> >> choose confirmation, key event etc.
>
> >> I have two questions..
>
> >> 1. Can we write a java code to click on OK button?
> >> 2. can we use Java script in selenium?
>
> >> if possible can any one please send me the code to click ok button...
>
> >> --
> >> Thanks,
> >> Naga
>
> >>
http://testerinyou.blogspot.com/
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Selenium Users" group.
> >> To post to this group, send email to
seleniu...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >>
selenium-user...@googlegroups.com<
selenium-users%2Bunsu...@googlegroups.com>
> >> .
> >
selenium-user...@googlegroups.com<
selenium-users%2Bunsu...@googlegroups.com>
> > .