How to trigger ng change in phantomjs

I am new to both corner and corner. I am currently working on a phantomjs script that access the angularjs application, which consists of an ng-change list. I need to call this ng change in order to get the correct data in a div to capture the screen. How can I trigger ng change in phantomjs?

        <ul class="list list-unstyled"
            ng-repeat="site in availableSites.sites |
                filter:searchFilter |
                orderBy:'site_name'">
            <li>
                <div class="radio">
                    <label>
                        <input type="radio"
                               ng-model="selections.siteID"
                               ng-value="site.site_id"
                               ng-change="changeSite(site.site_name)"
                               name="site">
                        {{site.site_name}}
                    </label>
                </div>
            </li>
        </ul>

This does not work when I try to do this in a phantomjs script:

        var siteSelection = document.querySelector('input[value="1007"]');
        var event = document.createEvent("HTMLEvents");
        event.initEvent("change", false, true);
        siteSelection.dispatchEvent(event);
+4
source share

Source: https://habr.com/ru/post/1537032/


All Articles