0

I am trying to select a row in html table and then click the activated Select/Submit button. Even though I am able to locate the row item, I cant perform Click action. By clicking this row I should see class change and Select button should be activated and then I can click but same story there too. I am manually selecting the row to see at if at least I can click this button but it doesn't work as well. Below is the table where I am supposed to select one of the options:

<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>

And here is the Select Button which basically submits my selection and move forward

<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>

EDIT:

This is my code

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

EDIT2:

I wanted to check if this is about those rows or generally clicking method for this page. I went full login and tried to click another button in the page and it didn't work. I can fill the inputs etc but cant click buttons or divs.

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
  • Please share your current coding attempt. For guidance on posting see [ask] and [mcve] – QHarr Sep 14 '19 at 12:53
  • Hello @QHarr I have added my coding attempt, thanks. – Zeynel ÖZTÜRK Sep 14 '19 at 15:49
  • And manually which actions produce the desired result? – QHarr Sep 14 '19 at 16:02
  • Clicking one of options higlights the option and at the same time Select button becomes active so that I can click after selecting option – Zeynel ÖZTÜRK Sep 14 '19 at 16:49
  • Can you share the url? If not, the html that shows the options – QHarr Sep 14 '19 at 17:13
  • I shared at the top of my question those table codes are the options. Options are in the table as table row – Zeynel ÖZTÜRK Sep 14 '19 at 17:51
  • From your description, it seems that when select the row item, you are using JavaScript script to change the active status, right? If that is the case, please check this part of code, make sure we could make the row item actived. Besides, I noticed that you are using disabled attribute to disable the select button, please check your code, after selecting the row item, you need to make sure the select button is enabled. Then, we could click it. If still not working, please share the related code or create a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Zhi Lv Sep 16 '19 at 12:41
  • Hi Zhi, since I asked the question I did more digging and I checked eventlisteners on the page, there is only one element which has Click eventlistener and that is a container div. I can focus and everything all the elements but clicking method doesn't work. – Zeynel ÖZTÜRK Sep 17 '19 at 15:48
  • can you post the Enough code (the website resource, include the css style and javascript script) to reproduce the problem as in [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Zhi Lv Sep 19 '19 at 15:12

0 Answers0