For info on attaching, see http://wiki.openqa.org/display/WTR/Pop+Ups

If you're trying to verify the existence of something in an <iframe>,
you'll need to specify the frame.  Example: browser.frame(id,
'id').whatever(:id, 'id').exists?

On Aug 13, 9:16 am, Chan Nguyen <atbl1...@gmail.com> wrote:
> Hi orde again,
>
> I tried to use your second method. Unfortunately, I always got "not
> exists" when I tested the link
>
> <a href="javascript:\\" onclick="window.open('http://
> media.rapmlsstg.com/help/10.01.01/', 'newWin',
> 'menubar=yes,toolbar=yes,resizable=yes,directories=no,scrollbars=yes,status 
> =yes');
> return false;" class="ImageLink"
> id="Module_3__ctl1__ctl0_hprOnlineHelp"><img border="0"
> align="absmiddle" style="margin-right: 5px;" src="http://
> media.rapmlsstg.com/rapmlsimages/onlinehelp.gif"
> id="Module_3__ctl1__ctl0_imgOnlineHelp">Online Help</a>
>
> The code that I use :
> # Since it's nested in a frame
> 1. main_frame.link( :id, "Module_3__ctl1__ctl0_hprOnlineHelp" ).click
> # Check the link to see if it exists?
> if browser.link( :id, "Module_3__ctl1__ctl0_hprOnlineHelp" ).exists?
> or
> if browser.link( :href, "http://media.rapmlsstg.com/help/
> 10.01.01/" ).exists?
>
> For your first solution, I'm a little vague about "assuming you've
> attached
> to the new page" ? How can I do this?
>
> Thanks,
>
> On Aug 12, 2:09 pm, Chan Nguyen <atbl1...@gmail.com> wrote:
>
>
>
> > Hi orde again, thanks a lot for your super sweet and quick response
> > ^_^ ! KISS !
>
> > On Aug 12, 2:03 pm, orde <ohil...@gmail.com> wrote:
>
> > > >1. Verify text in a new opened page?
>
> > > browser.text.include?("string_to_verify")  # assuming you've attached
> > > to the new page
>
> > > > 2. Verify some condition in current page?
>
> > > Just an example: browser.link(:id, 'id').exists?
>
> > > And you would probably want to put that into a begin/rescue/end
> > > statement to handle a failure case gracefully:
>
> > > begin
> > >   # assert/verify something (e.g. browser.text.include?
> > > ("string_to_verify"))
> > > rescue
> > >   # log the failure if it fails.
> > > end
>
> > > For some info on exception handling, check 
> > > outhttp://ruby-doc.org/docs/ProgrammingRuby/html/tut_exceptions.html(or
> > > your favorite .rb reference doc).
>
> > > Hope it helps.
>
> > > orde
>
> > > On Aug 12, 1:22 pm, Chan Nguyen <atbl1...@gmail.com> wrote:
>
> > > > Hi everyone,
> > > > I encountered a problem that when clicking on a link, it will open a
> > > > separate page. In other words, I will have 2 pages, so if I want to
> > > > verify the web is doing correctly? What should I do?
> > > > 1. Verify text in a new opened page?
> > > > 2. Verify some condition in current page?
> > > > For both 1 & 2, I don't really know how to start? Can anyone share me
> > > > an example?
> > > > Thanks,

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com

Reply via email to