【发布时间】:2019-11-26 16:01:01
【问题描述】:
我需要一些帮助。在 Excel (2013) VBE 中使用 Selenium Basic ChromeDriver (v 75.0.3770.140) 的 Chrome (v 75.0.3770.100)。如果客户 id# 存在,则有一个输入框会生成一个动态列表。我希望填写客户 ID#,然后从动态下拉列表中选择。但第一步,我正在努力将我的文本输入到框中。我可以点击带有
的框obj.FindElementById("selectcustTxt").Click
但是当我尝试用以下内容填写该框时:
obj.FindElementById("selectcustTxt").Value = "1111"
我收到一个错误运行时错误“424”:需要对象
我使用 .Value 和 .Text 尝试了以下 FindElementByXPath,但得到相同的运行时错误“424”:需要对象
obj.FindElementByXPath("//input[@class='form-control cust-autosuggest ng-pristine ng-valid ng-touched'][@id='selectcustTxt']").Value = "1111"
这是 HTML:
<div class="form-group search-field"><input id="selectcustTxt" type="text" class="form-control cust-autosuggest ng-valid ng-touched ng-dirty ng-valid-parse" autocomplete="off" plshholder="Enter Cust name" autocomplepte="off" ng-model="cust" suggest-type="custService" sh-autosuggest="custAddresses" data-validation="required">
【问题讨论】:
-
缺少
<和>的HTML 看起来格式不正确。你可以交叉检查一次吗? -
抱歉,刚刚编辑了 HTML,谢谢!
标签: excel vba selenium xpath css-selectors