vba - VBA-想要单击具有多个框架的元素
问题描述
有了上一个问题的答案,我向前迈进了一步,但仍然停留在我想单击该元素的地方,但它似乎有 2 帧,这就是我运行代码时给出的错误该元素未找到的原因,请检查附件和下面代码和建议。
Sub activeBexIE_Final()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'On Error Resume Next
Dim Perm_bot As New Selenium.IEDriver
Perm_bot.Get "official link"
Perm_bot.Wait 2000
Perm_bot.FindElementById("logonuidfield").SendKeys "XYZ"
Perm_bot.SendKeys Perm_bot.Keys.Tab
Perm_bot.SendKeys "PQR"
Perm_bot.SendKeys Perm_bot.Keys.Enter
Perm_bot.Wait 40000
Perm_bot.switchToFrame
Perm_bot.FindElementById("iframe_Roundtrip_9223372036563636042")
Perm_bot.FindElementById("BUTTON_OPEN_SAVE_btn1_acButton").SendKeys
Perm_bot.Keys.Enter
Perm_bot.Wait 30000' *till here I am sucessful- Opening Url-login-click on
"Open" option*
*'from here I am unable to move further, pls check attachment"select
layout" like how I wanted to select and also check the attachment "frame"
and "element" which is having the HTML details, not sure if this particular
element has 2 element, if yes then how I should write the script and after
this I wanted to do tab 7 times and then enter, kindly help for further
script, thanks in advance
'Perm_bot.switchToFrame Perm_bot.FindElementById("urPopupOuter0")
Perm_bot.switchToFrame Perm_bot.FindElementById("urPopupInner0")
Perm_bot.FindElementById("LOAD_state_tigen4_tlv1_list_unid6_tv").Click
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys "{ENTER}"
Perm_bot.Wait 10000
Application.DisplayAlerts = True
Application.ScreenUpdating = True
'perm_dot.Quit
'Set perm_dot = Nothing
End Sub
解决方案
I believe your concern is your iframes are having similar attributes and you have to switch to each one of it before tabing 7 times.
Approach would be Just like getting all windows handles and then loop you can use common xpath for iframe for e.g
findelements(By.Xpath("//iframes))
this will return iframe elements and then you can use loop and traverse and use
SwitchToFrame().
推荐阅读
- json - 无法在 OSB 中使用数组根将 JSON 转换为 XML
- python - 如何自动检测 Pyspark 数据框中包含日期时间的列
- python - 返回递归函数 - Python
- c - 为什么在连接 2 个字符串时出现错误?
- c - 分号真的是C中的一个序列点吗?
- javascript - 将字符串粘贴到vue2后如何删除字符串之间的空格
- spring - 我想为 th:onclick 使用 jquery 函数...我不会说英语
- javascript - ReferenceError:inCart 未在 Node.js 中定义
- html - 是否可以在单个 ts 文件中编写所有验证消息以反应形式重用它
- c - 当结构指针传递给函数时,为什么 fgets 在我的代码中不起作用?