我正在尝试在 html 表中选择一行,然后单击激活的选择/提交按钮。即使我能够找到行项目,我也无法执行单击操作。通过单击此行,我应该看到类更改和选择按钮应该被激活,然后我可以单击但那里也有同样的故事。我正在手动选择行以查看是否至少可以单击此按钮,但效果不佳。下面是我应该选择其中一个选项的表格:
<tbody id="__table0-tblBody"><
<tr tabindex="0" class="sapMLIB sapMLIB-CTX sapMLIBActionable sapMLIBFocusable sapMLIBHoverable sapMLIBShowSeparator sapMLIBTypeInactive sapMListTblRow" id="__item8-__table0-0" aria-selected="false" data-sap-ui="__item8-__table0-0">
<td class="sapMListTblHighlightCell" aria-hidden="true"></td>
<td class="sapMListTblCell" id="__item8-__table0-0_cell0" style="text-align: left;" headers="__text0">
<span class="sapMText sapMTextMaxWidth sapUiSelectable" id="__text1-__table0-0" style="text-align: left;" data-sap-ui="__text1-__table0-0">Option-1</span></td>
<td class="sapMListTblNavCol" aria-hidden="true"></td></tr>
<tr tabindex="0" class="sapMLIB sapMLIB-CTX sapMLIBActionable sapMLIBFocusable sapMLIBHoverable sapMLIBShowSeparator sapMLIBTypeInactive sapMListTblRow" id="__item8-__table0-0" aria-selected="false" data-sap-ui="__item8-__table0-0">
<td class="sapMListTblHighlightCell" aria-hidden="true"></td>
<td class="sapMListTblCell" id="__item8-__table0-0_cell0" style="text-align: left;" headers="__text0">
<span class="sapMText sapMTextMaxWidth sapUiSelectable" id="__text1-__table0-0" style="text-align: left;" data-sap-ui="__text1-__table0-0">Option 2</span></td>
<td class="sapMListTblNavCol" aria-hidden="true"></td></tr>
</tbody>
这是选择按钮,它基本上提交我的选择并继续前进
<footer class="sapMDialogFooter"><div class="sapContrast sapContrastPlus sapMFooter-CTX sapMIBar sapMIBar-CTX sapMTB sapMTB-Auto-CTX sapMTBInactive sapMTBNewFlex sapMTBNoBorders" id="__dialog0-footer" role="toolbar" data-sap-ui="__dialog0-footer" data-sap-ui-fastnavgroup="true">
<div class="sapMBarChild sapMTBSpacer sapMTBSpacerFlex" id="__spacer0" data-sap-ui="__spacer0"></div>
<button disabled="disabled" class="sapMBarChild sapMBtn sapMBtnBase sapMBtnDisabled" id="__button0" aria-disabled="true" aria-describedby="__text2" data-sap-ui="__button0">
<span class="sapMBtnEmphasized sapMBtnInner sapMBtnText" id="__button0-inner"><span class="sapMBtnContent" id="__button0-content">Select</span></span></button></div></footer>
编辑:
这是我的代码
Sub Macro()
Dim URL As String
Dim IE As InternetExplorer
Dim newIE As InternetExplorer
Set IE = New InternetExplorerMedium
'URL = "private server address"
'
'With IE
' .Visible = True
' .navigate URL
'End With
'
'
'Application.Wait (Now + TimeValue("0:00:05"))
'When excel connects first IE window is closing and in new window directed links is opening that's why I am connecting to this new window with GETIE function'
Set newIE = GetIE()
Do While newIE.Busy
DoEvents
Loop
Do While newIE.readyState <> 4
DoEvents
Loop
' Enter the UserId and Password
'
'newIE.Document.getelementbyid("j_username").Value = "User"
'newIE.Document.getelementbyid("j_password").Value = "Password"
'
'newIE.Document.getelementbyid("logOnFormSubmit").click
Do While newIE.Busy
DoEvents
Loop
Do While newIE.readyState <> 4
DoEvents
Loop
' After login I am having above shared html and following code doesnt work. I have tried to change class attributes to clicked version but still I have to click below Select button which doesn't work as well
If Not newIE.Document.getelementbyid("__item8-__table0-0") Is Nothing Then Debug.Print ("found")
newIE.Document.getelementbyid("__item8-__table0-0").click
End Sub
编辑2:
我想检查这是否与这些行或通常单击此页面的方法有关。我完全登录并尝试单击页面中的另一个按钮,但它不起作用。我可以填写输入等,但不能点击按钮或 div。