Using watin with angular

402 views
Skip to first unread message

Pepa Štefan

unread,
Nov 16, 2012, 7:48:57 AM11/16/12
to ang...@googlegroups.com
Hi, I tried to use Watin with Angular, but my attempt failed quite soon. I have a very simple form with some validations and a controller. Something like this: http://jsfiddle.net/dtgSF/

I started watin, opened page with this form and fill the form with watin (PowerShell code)

$companyName = 'test company'
$ie.TextField('company').value = $companyName
$ie.TextField('email').value = 'ad...@cn.com'
$ie.TextField('password1').value = 'pass'

GetButton -Id register | Click

After I call click, the register() handler is called. The $scope.regform.$invalid is still true, so $scope.regform.$setDirty(true); is called and the form is turned to red.

What should I call to notify angular that content of the fields has changed? Then $scope.regform.$invalid would be false and the registration might continue.

If I call 
$ie.Eval('App.run(function($rootScope) { $rootScope.$digest(); });')
it doesn't help.

Мишаня Дзюба

unread,
Jan 2, 2014, 5:44:13 AM1/2/14
to ang...@googlegroups.com
Try this:
CurrentBrowser.RunScript(String.Format("$( \"{0}[ng-model='{1}']\" ).trigger('input')", element.TagName, modelName)); //if you are using nt-model attribute for selection or
CurrentBrowser.RunScript(String.Format("$( \"#{0}\" ).trigger('input')", element.Id)); //if you select it by ID

RamblingCoder

unread,
Jul 18, 2014, 12:06:31 AM7/18/14
to ang...@googlegroups.com
I was successful with my issue by using the information from "Мишаня Дзюба" but using "change" instead of "input" for the trigger parameter.
Reply all
Reply to author
Forward
0 new messages