This is more of a ruby question than a watir question.  I'd suggest
reading up on common control structures.  There is good documentation
at http://www.ruby-lang.org/en/documentation/ or (specific to your
question) 
http://www.howtogeek.com/howto/programming/ruby/ruby-if-else-if-command-syntax/




On Jun 16, 8:51 am, era gupta <era.gupt...@gmail.com> wrote:
> This is what I want to know, How to use an If statement in this condition.
>
> On Thu, Jun 16, 2011 at 7:42 PM, Rahul Sharma 
> <rahulsharma....@gmail.com>wrote:
>
>
>
>
>
>
>
> > After you have logged in you need to do  a check if login is prompted
> > again...use an "if" statement or something
>
> > On Jun 16, 2:13 pm, era gupta <era.gupt...@gmail.com> wrote:
> > > Thanks Chuck for your response.
>
> > > Find below the code that I am trying to access:
>
> > > require 'watir'
> > > Watir::Browser.default = 'firefox'
> > > b = Watir::Browser.new
> > > b.goto "<site-url>"
> > > b.link(:href, "<Link to access>").click
> > >         b.text_field(:id, "email_id").set("ad...@test.com")
> > >         b.text_field(:name, "pass").set("test")
> > >         b.link(:text, "Login").click
>
> > > In the above code line no. 6,7 and 8 I want to call when the site asks
> > for
> > > the login again. Otherwise it should go to some other task.
>
> > > Any Idea how it can be done.
>
> > > On Thu, Jun 16, 2011 at 2:32 AM, Chuck van der Linden <sqa...@gmail.com
> > >wrote:
>
> > > > On Jun 15, 5:12 am, Era <era.gupt...@gmail.com> wrote:
> > > > > Hi,
>
> > > > > I am new in watir group and not very good in watir scripting. Please
> > > > > help me to write the script for the following scenario:
>
> > > > > There is one web application in which the user can access the main
> > > > > elements by logging into the account. But there is some issue in the
> > > > > login window. It sometimes asks to login twice it means the user has
> > > > > to give the username and password and then click on login button,
> > then
> > > > > again enter the same username and password and click on login window.
>
> > > > We're here to help, buy there is a limit, writing all the code for you
> > > > is past the limit.
> > > > What you can expect is responses in the area of helping when/where you
> > > > get stuck, and helping you refine your approach, or suggesting other
> > > > things to try instead.  With that in mind, please respond as best you
> > > > can tot he following:
>
> > > > Does your system always do this, or is there some random element which
> > > > controls when someone is asked for their credentials a second time?
>
> > > > Is there an easy way to tell (such as perhaps the page title) if the
> > > > user is still faced with a request for credentials verses logged into
> > > > the system?
>
> > > > Is the page source the same on both pages that request credentials?
>
> > > > Can you provide please a sample of the page's HTML and also most
> > > > important of all, the applicable Watir automation code you have tried
> > > > so far?
>
> > > > --
> > > > Before posting, please readhttp://watir.com/support. In short: search
> > > > before you ask, be nice.
>
> > > > watir-general@googlegroups.com
> > > >http://groups.google.com/group/watir-general
> > > > watir-general+unsubscr...@googlegroups.com<
> >http://groups.google.com/group/watir-general%0Awatir-general+unsubscr...>
>
> > --
> > Before posting, please readhttp://watir.com/support. In short: search
> > before you ask, be nice.
>
> > watir-general@googlegroups.com
> >http://groups.google.com/group/watir-general
> > watir-general+unsubscr...@googlegroups.com<http://groups.google.com/group/watir-general%0Awatir-general+unsubscr...>

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to