华廷 - 提交按钮仍然填表格后停用 [英] Watin - Submit button remain disabled after filling form
问题描述
我有一个网站,我需要自动登录。照片
我想使用华廷.NET库,以做到这一点。
当我填写使用华廷的用户名和密码字段,则透过按钮保持禁用。
我试图在其他领域应用的许多事件(主要preSS,的KeyDown,的KeyUp,Tab键,回车...)毫无效果。
原谅我发现通过值的按钮,但是这是我发现的工作的唯一办法。
VAR场= ie.TextField(Find.ByName(username的));
field.TypeText(用户名);
field.KeyDown();
field.KeyUp();
场= ie.TextField(Find.ByName(密码));
field.TypeText(PWD);
field.KeyDown();
field.KeyUp();
。ie.Button(Find.ByValue(התחבר))点击();
我得到一个例外,该按钮被禁用。
我需要登录的页面:
https://portal.dorad.co.il/#/Login
所有我想要的是找到一个自动的方式,使透过按钮启用,以便我可以登录。
登录表单code:
<窗体类=span5 OFFSET4登录表单NG-原始NG-无效的NG-无效的要求的NAME =登录表单NG提交=doLogin()自动完成=关闭>
< H2>
登录
< / H>
<字段集>
< DIV CLASS =控制组>
<标签类=控制标签为=全名>
用户名
< /标签>
< DIV CLASS =控制>
<输入名称=username的ID =USENAMENG-所需=真正的类型=文本NG-模式=user.userName自动填充同步=自动完成=关闭级= NG-质朴的NG-无效的NG-无效的要求的需要=必要的>
<跨度类=警报警报错误NG秀=loginForm.userName $ error.required和放大器;放大器;&放大器;放大器; loginForm.userName $脏。样式=显示:无;>
必填项
< / SPAN>
< / DIV>
< / DIV>
< DIV CLASS =控制组>
<标签类=控制标签为=EMAILADDRESS>
密码
< /标签>
< DIV CLASS =控制>
<输入名称=密码ID =密码类型=密码NG-模式=user.password的自动填充同步=NG-所需=真正的自动完成=关闭级= NG-质朴的NG-无效的NG-无效的要求的需要=必要的>
<跨度类=警报警报错误NG秀=。loginForm.password $ error.required和放大器;放大器;&放大器;放大器; loginForm.password $脏。样式=显示:无;>
必填项
< / SPAN>
< / DIV>
< / DIV>
< /字段集>
<输入类型=提交级=BTN值=התחברNG-禁用=登录表单$无效禁用=禁用>
< /形式GT;
这可能是由于一个事件被阻塞射击。 请尝试使用:
元素FG = ie.TextField(Find.ByName(密码));
fg.DomContainer.RunScript($('#+ fg.id +')的变化(););
这解决了类似的问题对我来说。
I have a website which I need to login to automatically.
I am trying to use Watin .NET library in order to do that.
When I fill out the user name and password fields using Watin, the sumbit button remains disabled.
I tried applying many events on the other fields (KeyPress, KeyDown, KeyUp, Tab, Enter...) Nothing worked.
Pardon me for finding the button by value, but this is the only way that I found that worked.
var field = ie.TextField(Find.ByName("userName"));
field.TypeText("username");
field.KeyDown();
field.KeyUp();
field = ie.TextField(Find.ByName("password"));
field.TypeText("pwd");
field.KeyDown();
field.KeyUp();
ie.Button(Find.ByValue("התחבר")).Click();
I am getting an exception that the button is disabled.
The page which I need to login to is:
https://portal.dorad.co.il/#/Login
All that I want is to find an automatic way to make the sumbit button enabled so that I can login.
Login Form Code:
<form class="span5 offset4 loginForm ng-pristine ng-invalid ng-invalid-required" name="loginForm" ng-submit="doLogin()" autocomplete="off">
<h2>
Login
</h2>
<fieldset>
<div class="control-group">
<label class="control-label" for="fullName">
User Name
</label>
<div class="controls">
<input name="userName" id="useName" ng-required="true" type="text" ng-model="user.userName" auto-fill-sync="" autocomplete="off" class="ng-pristine ng-invalid ng-invalid-required" required="required">
<span class="alert alert-error" ng-show="loginForm.userName.$error.required && loginForm.userName.$dirty" style="display: none;">
Mandatory Field
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="emailAddress">
Password
</label>
<div class="controls">
<input name="password" id="password" type="password" ng-model="user.password" auto-fill-sync="" ng-required="true" autocomplete="off" class="ng-pristine ng-invalid ng-invalid-required" required="required">
<span class="alert alert-error" ng-show="loginForm.password.$error.required && loginForm.password.$dirty" style="display: none;">
Mandatory Field
</span>
</div>
</div>
</fieldset>
<input type="submit" class="btn" value="התחבר" ng-disabled="loginForm.$invalid" disabled="disabled">
</form>
This might be due to firing of an event getting blocked. Try using:
Element fg = ie.TextField(Find.ByName("password"));
fg.DomContainer.RunScript("$('#"+fg.id+'").change();");
This solved a similar problem for me.
这篇关于华廷 - 提交按钮仍然填表格后停用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!