0

I am using MSHTML to automate oen workflow involved Angular. I am able to add the value in text box but somehow underline function doesn't get call and hence I get unwanted result. below is the sample:

objIHTMLElement = doc.getElementById("email");
objIHTMLElement.setAttribute("value", "sas@abc.com");

html looks as below:

<div class="inpt-fld-err-msg-inline">
    <input title="Email Add"
           class="ng-valid ng-valid-maxlength ng-touched ng-dirty ng-empty"
           id="email" aria-invalid="false" type="text" maxlength="50"
           ng-change="save(SearchParams)"
           ng-model="SearchParams.userProfil" autocomplete="off">
</div>

is there any way to do it using C#?

Regards, Ajit

1 Answers1

0

You can register and call you javascript method by passing appropriate parameters via following syntax from C#: Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","save(" + SearchParams + )",true);

Kindly refer to this post: Calling JavaScript Function From CodeBehind

  • Thanks for your reply. I am automating angular page using MSHTML. i am able to set the values to control, but somehow the associated ng-change event not triggered. let me see how the solution which you have provided will work in this case. – user3523576 Oct 23 '18 at 14:14
  • I tried the solution which you have provided, but unfortunately i am working with console based application. and hence I don't want to add web references. – user3523576 Oct 23 '18 at 15:35