Reputation: 5237
I have this element
<div class="btn">
<input type="submit" ng-disabled="form.$invalid" ng-click="submit(user)" value="Sign In" />
</div>
that submits login data. I tried following ways, but they not working:
$('div[class="btn"] > input').click();
$('div[class="btn"] > input').submit();
How to submit by other way?
Upvotes: 0
Views: 456
Reputation: 9272
jQuery's events are maintained in local scope, and using an injected jQuery to click
from PhantomJS will not necessarily invoke the event you want--you'd have to obtain a handle to the page jQuery.
However, you're probably trying to test user behavior. A better test is to dispatch a click as a user event, as described here: PhantomJS; click an element
Upvotes: 1