html - 基本硒无法按类查找元素
问题描述
我正在尝试使用 BasicSelenium, Selenium for VBA 在门户网站中填写电话号码,但即使元素已加载,Selenium 也无法找到文本框
我的代码
Sub FillPhoneNumbers()
Set ch = New Selenium.ChromeDriver
ch.Start
ch.Get "https://nestlemedconnect.com/p/38ZX1SBcKhI"
ch.FindElementByClass("checkbox_label").Click
ch.FindElementByClass("accept_button").Click
ch.FindElementByCss(".left_button_inner.generic_menu_button.ti-comments-smiley").Click
ch.Wait (30)
ch.FindElementByClass("phonemask").SendKeys "122525" ' <- line that errors
End Sub
而我试图填充的元素
<input class="phonemask" type="tel" name="phoneNumber" autocomplete="off" data-intl-tel-input-id="0" style="padding-left: 74px;" placeholder="201-555-0123">
我尝试使用该名称,但也没有用,我得到的只是 Web 驱动程序无法找到 elemet 错误
我究竟做错了什么?
解决方案
因为您需要先单击此 Web 元素退出 SMS
div.ui.bottom.attached.button.optout.triggerform
做这个 :
ch.FindElementByCss("div.ui.bottom.attached.button.optout.triggerform").Click
ch.Wait (30)
ch.FindElementByClass("phonemask").SendKeys "122525
推荐阅读
- javascript - Konva 中的动画线位置
- excel - 自动将数据从 Power Bi 导出到 Excel
- terraform - Terraform init 无法验证校验和
- r - 是否有一个 R 函数,我可以在其中获取数据集中特定列中的名称
- mysql - 如何使用 SQL 选择特定字段的重复行,允许时差?
- reactjs - 我怎样才能让按钮写文字?
- azure-functions - 通过数据工厂中的 azure 函数删除 azure 存储表的问题
- java - 如何在不将未加密的密码发送到服务器的情况下验证密码
- rust - 如何在不消耗值的情况下实现 Add trait
- c# - 如何在 UWP 中最小化按钮旁边的标题栏中添加一个新按钮?