Button does not click (AngularJS)

2 posts, 0 answers
  1. Paul
    Paul avatar
    3 posts
    Member since:
    Dec 2013

    Posted 23 Jul 2014 Link to this post

    Hi,

    I have a web site that user AngularJS but having a problem getting a button clicked;

    The problem here is that I can find the element with id X and does not through any errors clicking on the elment.

    My Code:


    Console.WriteLine(name + ":Finding Button: " + id);
                    var element = myManager.ActiveBrowser.Find.ById(id);
                    if (element == null)
                    {
                        Console.WriteLine(name + ":Input not found");
                        return false;
                    }

                    myManager.ActiveBrowser.WaitUntilReady();
                    Console.WriteLine(name +":Button Found, clicking on it!");
                    myManager.ActiveBrowser.Actions.Click(element);





    Nothing happens, no errors etc, below is the html:
      <form role="form"  id="LoginForm" name="LoginForm">
                    <input type="text" class="col-xs-6 form-control" id="userName" placeholder="Username" title="Username" ng-model="Login.Model.Username" required local="Username"/>
                    <input type="password" class="  col-xs-6 form-control" id="Password" placeholder="Password" title="Password" ng-model="Login.Model.Password" required local="Password">
                    <button type="submit" id="Submit" class="btn btn-red col-md-12" ng-click="Login.Login(LoginForm.$invalid)" local="Login">Login</button>
                    <p class="text-center"><a href="#NewApplication" class="register-link" local="Register">Register</a></p>
                    
                        <select langbar></select>
                    
                </form>




    Any help would be great.

    Thanks
    Paul.
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 28 Jul 2014 Link to this post

    Hi Paul,

    Thank you for contacting us.

    Unfortunately I am not able to reproduce the issue. I executed your code and everything worked as expected.

    I have modified it slightly.

    1. Remove Return false from the IF block.

    2. Add Else block which will contain the click step.

    Give that a try and let us know the result.

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top