简体   繁体   English

如何自动点击加载页面?

[英]How can I autoclick on a loading page?

Hi there I would like to autofill a page on loading which is include ng-repeat parameter.您好,我想在加载时自动填充一个包含 ng-repeat 参数的页面。 well I need a script to doing this and automatically click on one of the option appear.好吧,我需要一个脚本来执行此操作并自动单击出现的选项之一。 the following code is the html code of the page.以下代码是页面的html代码。

I wrote this script but did not work.我写了这个脚本,但没有工作。 document.querySelectorAll('.sd-Items')[1].click(); document.querySelectorAll('.sd-Items')[1].click();

<div class="sd-titleSideBar">
    <strong>Color Selection</strong>
</div>
<div class="sd-selectColor">
    <!-- ngRepeat: color in model.colors -->
    <div ng-repeat="color in model.colors" class="inventory sd-Items ng-scope 
  selectedItem" ng-class=" 
 {'selectedItem': color.id == selectedColor}" ng-click="colorClick(color.id)">
        <div style="width: 30px; height: 30px; border-width: 2px; border-style: 
 ridge !important; background-color: rgb(255, 255, 255);" class="col-md-1" ng-style="{'background-color': color.omi}"></div>
        <label class="ng-binding"> White</label>
        <!-- ngIf: !color.ohc -->
    </div><!-- end ngRepeat: color in model.colors -->
    <div ng-repeat="color in 
 model.colors" class="inventory sd-Items ng-scope" ng-class=" 
{'selectedItem': color.id == selectedColor}" ng-click="colorClick(color.id)">
        <div style="width: 30px; height: 30px; border-width: 2px; border-style: 
ridge !important; background-color: rgb(25, 25, 175);" class="col-md-1" ng-style="{'background-color': color.omi}"></div>
        <label class="ng-binding"> Blue</label>
        <!-- ngIf: !color.ohc -->
    </div><!-- end ngRepeat: color in model.colors -->
</div>

If you're calling methods of AngularJs, then you need to define those methods inside controller for that element.如果您正在调用 AngularJs 的方法,那么您需要在 controller 中为该元素定义这些方法。

You can get more information from this webpage and this tutorial for angularjs.您可以从此网页和 angularjs 教程获取更多信息。

https://www.w3schools.com/angular/angular_databinding.asp https://www.w3schools.com/angular/angular_databinding.asp

See AngularJS controller section.参见 AngularJS controller 部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM