2 Replies Latest reply on Aug 29, 2018 12:38 AM by ashish bansode

    Need to simulate a click on Tableau web portal b

    ashish bansode

      Hello Guru's,

       

      I want to automate report extraction and save it in a particular folder, i have started the same in VBA as i am unable to use JavaScript API for my task due to limited access on my user rights.

       

      i am successfully able to login into the web portal but i am stuck in clicking the report tab which is inside a list box and its written in SAP-fouri or Advance HTML language i am unable to understand the elements and simulate a click.

       

      below is my code and html source code , any help would be appreciated.

       

      HTML Source code

       

      <li id="__xmlview1--listMyReports" data-sap-ui="__xmlview1--listMyReports" tabindex="-1" role="option" aria-selected="false" class="sapMLIB sapMLIB-CTX sapMLIBActionable sapMLIBFocusable sapMLIBHoverable sapMLIBShowSeparator sapMLIBTypeInactive sapMSLI sapMSLIIcon sapMSLIIconThumb sapMSLINoDescIcon"><div class="sapMLIBContent" id="__xmlview1--listMyReports-content"><span id="__xmlview1--listMyReports-img" data-sap-ui="__xmlview1--listMyReports-img" role="presentation" aria-hidden="true" data-sap-ui-icon-content="" class="sapMSLIImgThumbIcon sapUiIcon sapUiIconMirrorInRTL" style="font-family:'icomoon'"></span><div class="sapMSLIDiv sapMSLITitleDiv"><div class="sapMSLITitleOnly">My Reports</div><div id="__xmlview1--listMyReports-info" class="sapMSLIInfo sapMSLIInfoNone">314</div></div><div class="sapMSLIDescriptionDiv"></div></div></li>

       

      VBA Code

      Function IEWindowFromTitle(sTitle As String) As SHDocVw.InternetExplorer     
       Dim objShellWindows As New SHDocVw.ShellWindows     Dim win As Object, rv As SHDocVw.InternetExplorer      
      For Each win In objShellWindows  
             If TypeName(win.doc
      ument) = "HTMLDocument" Then      
             If UCase(win.document.Title) = UCase(sTitle) Then 
                      Set rv = win           
            Exit For             End If    
           End If     Next
            Set IEWindowFromTitle = rv  End Function   
        Sub Tester() 
      Dim ie As InternetExplorer Dim doc As HTMLDocument Dim itm As Object 
       Set ie = New InternetExplorer ie.navigate "https://XXXX.XXX.com"  
      Application.Wait Now() + TimeValue("00:00:09") 
       Set ie = IEWindowFromTitle("XXXXXX"
      )     If ie Is Nothing Then MsgBox "Not Found": Exit Sub
        Do While ie.readyState <> READYSTATE_COMPLETE 
      DoEvents
       Loop
        Set doc = ie.document  
       'trying to click the button but not working as accepted :( 
      Set itm = doc.getElementById("__xmlview1--listMyReports") 
      If Not itm Is Nothing Then 
      itm.Focus
       itm.Click
       End If 
       ''enter report name in search box working like charm :) 
      Set itm = doc.getElementById("__field0-I")
       If Not itm Is Nothing Then 
      itm.Value = 269 
      End If 
         End Sub