gpt4 book ai didi

javascript - 使用 javascript/VBA 以编程方式输入 angularjs 文本字段

转载 作者:行者123 更新时间:2023-11-28 18:21:59 25 4
gpt4 key购买 nike

我使用 Excel VBA 从 AngularJS 应用程序中进行网页抓取。我尝试使用类似 ie.Document.getElementsByTagName("button")(15).Value = "112233" 在文本输入中输入值 我也尝试过 - ie.Document.parentWindow.execScript "document.getElementsByTagName('button')[15].Value = '112233';

它们都不起作用。我搜索了一些其他发布的问题,但问题仍然存在。该元素是:

<input whole-number="" type="text" maxlength="20" class="......" ng-model="pList.pNumber" bs-typeahead="typeahead_ProjectNumber"  placeholder="enter a value" data-provide="typeahead" ng-change="reduceScrollMax()">

最佳答案

我找到了问题的解决方案:

angular.element(document.getElementByTagName('input')[15]).scope().pList.pNumber = '112233';

其次是 angular.element(document.getElementByTagName('input')[15]).scope().$apply();angular.element(document.getElementByTagName('input')[15]).scope().$digest();

包括 ie.Document.parentWindow.execScript "..." 中提到的上述内容使用 VBA 运行它。

关于javascript - 使用 javascript/VBA 以编程方式输入 angularjs 文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39752893/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com