in your code you are using :id => "txtUserNameM" for both the username and
password...
im going to guess thats just a copy paste problem.

what is the error you get when you run your code?



On Tue, Jan 14, 2014 at 3:51 PM, Fosiul Alam <[email protected]> wrote:

> Hi Experts.
> I am tying to use watir to setup a monitoring for a webpage.
> I am trying to login to the home page by using user name and password.
>
> I am using Firefox as browser, but i cant login,
>
> 1)How do i debug the issue to understand where its failing?
>
> 2) from my understanding, if firefox can login to that site, Watir should
> be able to login right ??
>
>
> the watir is clicking the button but the site say "invalid login"
> i am using bellow code :-
>
> b = Watir::Browser.new :firefox, :profile => 'default'
> b.goto 'http://xxxxxxxx'
> b.text_field(:id => "txtUserNameM").fire_event('onfocus')
> b.text_field(:id => "txtUserNameM").set 'username'
> b.text_field(:id => "txtUserNameM").fire_event('onfocus')
> b.text_field(:id => "txtUserNameM").set("password")
> b.button(:name => 'btnLogin_input').click
>
>
> the Code behind the login (just an example as the site use too much java
> script validation:-
>
>
>  <form name="form1" method="post" action="xxxxx"
> onsubmit="javascript:return WebForm_OnSubmit();"
> onkeypress="javascript:return WebForm_FireDefaultButton(event, 'btnLogin')"
> id="form1">
>
>
> <td><span id="lblUserNameM" class="Reg">User Name</span></td>
>             <td><input name="txtUserNameM" type="text" id="txtUserNameM"
> class="xxxxx" autocomplete="off"
> style="border-color:#A09E9F;border-width:1px;border-style:Solid;width:200px;"
> /><span id="txtUserNameMValidator" class="txtFormErr"
> MyPrevControlUniqueID="txtUserNameM" style="color:Red;display:none;">
> xxxxxxxr</span></td>
>         </tr>
>         <tr>
>             <td><span id="lblPasswordM" class="Reg">Password</span></td>
>             <td><input name="txtPasswordM" type="password"
> id="txtPasswordM" class="txtForm" autocomplete="off"
> style="border-color:#A09E9F;border-width:1px;border-style:Solid;width:200px;"
> /><span id="txtPasswordMValidator" class="txtFormErr"
> MyPrevControlUniqueID="txtPasswordM"
> style="color:Red;display:none;">xxxxxxxr</span></td>
>         </tr>
>
>
> Can any one please help, I am trying to solve this from last couple of
> days.
>
>
>
>  --
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Watir General" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to