Jump to content

click on Document List in SAP Businessobject Infoview


Recommended Posts

@MRAJ We are indeed running in circles (more information in detail is needed: HTML Pages, input, output of scite, IE versions, .......)

You probably have to study much more on how to analyze your HTML pages 

Anyway another example on how to analyze your page from coding from a generic page on internet with frames
 

#include <ie.au3>
#include <Timers.au3>

_IEErrorHandlerRegister(_User_ErrFunc)

_Example()

Func _Example()
    Local $oIE = _IECreate('https://www.w3.org/WAI/UA/TS/html401/cp0101/0101-FRAME-TEST.html', 0, 1, 0)
    Local $hStarttime = _Timer_Init()
    _IELoadWait($oIE)

    ConsoleWrite('> 1 = ' & _Timer_Diff($hStarttime) & @CRLF)

    _IELoadWait_ForAllFrames($oIE)

    Local $oFrames = _IEFrameGetCollection($oIE)
    Local $iNumFrames = @extended
    Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
    Local $oFrame = 0

        For $i = 0 To ($iNumFrames - 1)
        $oFrame = _IEFrameGetCollection($oIE, $i)
        local $oElements
        local $tagType="p"
;~      local $tagType="span"
        
        $oElements=$oframe.document.getElementsByTagName($tagType)
        
        consolewrite("Hooray we found " & $oElements.length & " elements of type " & $tagType & @CRLF)
        
;~ Now dump all tags regardless of type     
        $oElements = _IETagNameAllGetCollection ($oFrame)
        For $oElement In $oElements
          consolewrite($oElement.tagname)
        Next
        consolewrite(@CRLF)

    Next

    ConsoleWrite('> 2 = ' & _Timer_Diff($hStarttime) & @CRLF)
;~     _IEQuit($oIE)
EndFunc   ;==>_Example


Func _IELoadWait_ForAllFrames(ByRef $oObject, $iDelay = 0, $iTimeout = Default)
    _IELoadWait($oObject, $iDelay, $iTimeout)
    If @error Then Return SetError(@error, @extended, -1)

    Local $oFrames_coll = _IEFrameGetCollection($oObject)
    #forceref $oFrames_coll
    Local $iNumFrames = @extended
    Local $oFrame = Null
    For $iFrame_idx = 0 To ($iNumFrames - 1)
        $oFrame = _IEFrameGetCollection($oObject, $iFrame_idx)
        _IEDocGetObj($oFrame)
        If Not @error Then
            _IELoadWait($oFrame, $iDelay, $iTimeout)
            If @error Then Return SetError(@error, @extended, -1)
        EndIf
    Next

    Return SetError($_IESTATUS_Success, 0, 1)

EndFunc   ;==>_IELoadWait_ForAllFrames


; User's COM error function.
Func _User_ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptFullPath & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_User_ErrFunc

study this in detail

https://www.autoitscript.com/autoit3/docs/libfunctions/_IELinkGetCollection.htm

and make sure you make a difference between IE object and frame object

$oObject Object variable of an InternetExplorer.Application, Window or Frame object
Link to comment
Share on other sites

please also add more detail.
I was rereading the thread and see we miss a lot of additional information that could be helpfull

Step 1 is to understand your HTML DOM page hierarchy

  • Do right mouse-context menu and choose inspect element.
    Attach screenshot as it will give directly an indication of your html hierarchy
  • Teach yourself the IE 11 Developer tools (I assume you are on IE) with console tab to reveal more structure of your HTML page

Try (and understand) things like below in IE 11 developer tools console tab:

console.log(window.frames.length)
cd(window.frames[2])
console.log(window.document.body.innerHTML)
console.log(window.document.activeElement.innerText)
console.log(window.document.activeElement.parentElement.parentElement.parentElement.innerHTML)
cd(window.frames[0])
console.log(window.frames[2].document.activeElement.innerText)
  • check FAQ 31 and install simplespy of iuiautomation thread. Post output of spy in this thread
    It will in general tell me the full hierarchy of your element but at least it will tell things on the frames
Edited by junkew
request to post simplespy output
Link to comment
Share on other sites

1)Attached is HTML page and inspect element of the Public Folders:

2) <SPAN id=ListingURE_treeNode4_name style="WHITE-SPACE: nowrap"><IMG id=ListingURE_treeNodeIcon_4 style="HEIGHT: 16px; WIDTH: 16px" border=0 alt="" src="https://InfoViewAppActions/ure/ure/cache/images/kind/Folder/Unexpanded.gif">&nbsp;Public Folders&nbsp;</SPAN>

3) i also tried and run the above script for finding the elemenst...i didnt find any elements for tagtype P and span but i found for IMG and DIV and TD

> 1 = 40.5339226074822
Hooray we found 52 elements of type td
HTMLHEADTITLELINKSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTLINKSCRIPTSCRIPTBODYTABLETBODYTRTDSPANTABLETBODYTRTDTDTDTDIMGTRTDSCRIPTDIVTABLETBODYTRTDTABLETBODYTRTDTABLETBODYTRTDADIVDIVTDSPANTDIMGTDTABLETBODYTRTDADIVTDSPANTDIMGTDTABLETBODYTRTDTABLETBODYTRTDADIVTDSPANTDTABLETBODYTRTDADIVDIVTDIMGTDTABLETBODYTRTDTABLETBODYTRTDADIVTDSPANTDTABLETBODYTRTDADIVDIVTDIMGTDTABLETBODYTRTDTABLETBODYTRTDADIVTDSPANTDTABLETBODYTRTDADIVDIVTDTABLETBODYTRTDTABLETBODYTRTDADIVTDSPANTDIMGTDTABLETBODYTRTDADIVTDSPANTDIMGTDTABLETBODYTRTDADIVTDSPANTDIMGTDTABLETBODYTRTDADIVTDSPANTRTDIFRAMEIFRAMEAAAA
> 2 = 348.853974457648
>Exit code: 0    Time: 16.46
 

4) How to install simplespy and get the information. I have copied the two zip file(UIA_V0_66 and EXAMPLES_V0_66), now how to proceed?

 

Let me know if you need any more information.

 

Edited by MRAJ
Link to comment
Share on other sites

you seem to be close

  • try uppercase SPAN 
  • try for the one that gives you 52 elements (although that surprises me it seems to do something)
    consolewrite($oElement.tagname & $oElement.id & $oElement.innerText)
  • Based on the attached html I do not see a reason why you could not click on that element
  • I would have expected getElementById("ListingURE_treeNode4_name") would have worked no explanation why not
    SPAN id=ListingURE_treeNode4_name

 

Link to comment
Share on other sites

I found the below output:

   
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (ListingURE_treeNode4_name)
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
> 1 = 5.61656579257978
Hooray we found 10 elements of type SPAN
HTMLHTMLSAP BusinessObjects InfoView Toolbar    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutHEADHEADSAP BusinessObjects InfoView ToolbarTITLETITLESAP BusinessObjects InfoView ToolbarLINKLINKSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTSCRIPTLINKLINKdhtmlLibCurrCssSCRIPTSCRIPTSCRIPTSCRIPTBODYBODY    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTABLETABLE    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTBODYTBODY    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTRTR    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTDTD    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutSPANSPANtop    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTABLETABLE    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTBODYTBODY    
Home
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTRTR    TDTD TDTD TDTD TDTD IMGIMGTRTRHome
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTDTDHome
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutSCRIPTSCRIPTDIVDIVtoolbarContainerHome
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTABLETABLEtoolbarHome
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTBODYTBODYHome
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTRTRHome
Document List
Open


Send To


Dashboards

Help
Preferences
About
Log OutTDTDHome
Document List
Open


Send To


DashboardsTABLETABLEHome
Document List
Open


Send To


DashboardsTBODYTBODYHome
Document List
Open


Send To


DashboardsTRTRHome
Document List
Open


Send To


DashboardsTDTDHomeTABLETABLEbtnHomeHomeTBODYTBODYHomeTRTRHomeTDTDAADIVDIVDIVDIVIconImg_btnHomeTDTDHomeSPANSPANIconImg_Txt_btnHomeHomeTDTDIMGIMGtoolbar_palettesep_0TDTDDocument ListTABLETABLEbtnListingDocument ListTBODYTBODYDocument ListTRTRDocument ListTDTDAADIVDIVTDTDDocument ListSPANSPANIconImg_Txt_btnListingDocument ListTDTDIMGIMGtoolbar_palettesep_1TDTDOpenTABLETABLEbtnApplicationsOpenTBODYTBODYOpenTRTROpenTDTDOpenTABLETABLEiconMenu_icon_btnApplicationsOpenTBODYTBODYOpenTRTROpenTDTDAADIVDIVTDTDOpenSPANSPANIconImg_Txt_iconMenu_icon_btnApplicationsOpenTDTDTABLETABLEiconMenu_arrow_btnApplicationsTBODYTBODYTRTRTDTDAADIVDIVDIVDIVIconImg_iconMenu_arrow_btnApplicationsTDTDIMGIMGtoolbar_palettesep_2TDTDSend ToTABLETABLEbtnSendSend ToTBODYTBODYSend ToTRTRSend ToTDTDSend ToTABLETABLEiconMenu_icon_btnSendSend ToTBODYTBODYSend ToTRTRSend ToTDTDAADIVDIVTDTDSend ToSPANSPANIconImg_Txt_iconMenu_icon_btnSendSend ToTDTDTABLETABLEiconMenu_arrow_btnSendTBODYTBODYTRTRTDTDAADIVDIVDIVDIVIconImg_iconMenu_arrow_btnSendTDTDIMGIMGtoolbar_palettesep_3TDTDDashboardsTABLETABLEbtnDashboardsDashboardsTBODYTBODYDashboardsTRTRDashboardsTDTDDashboardsTABLETABLEiconMenu_icon_btnDashboardsDashboardsTBODYTBODYDashboardsTRTRDashboardsTDTDAADIVDIVTDTDDashboardsSPANSPANIconImg_Txt_iconMenu_icon_btnDashboardsDashboardsTDTDTABLETABLEiconMenu_arrow_btnDashboardsTBODYTBODYTRTRTDTDAADIVDIVDIVDIVIconImg_iconMenu_arrow_btnDashboardsTDTDHelp
Preferences
About
Log OutTABLETABLEHelp
Preferences
About
Log OutTBODYTBODYHelp
Preferences
About
Log OutTRTRHelp
Preferences
About
Log OutTDTDHelpTABLETABLEbtnHelpHelpTBODYTBODYHelpTRTRHelpTDTDAADIVDIVTDTDHelpSPANSPANIconImg_Txt_btnHelpHelpTDTDIMGIMGtoolbar_palettesep_4TDTDPreferencesTABLETABLEbtnPrefsPreferencesTBODYTBODYPreferencesTRTRPreferencesTDTDAADIVDIVTDTDPreferencesSPANSPANIconImg_Txt_btnPrefsPreferencesTDTDIMGIMGtoolbar_palettesep_5TDTDAboutTABLETABLEbtnAboutAboutTBODYTBODYAboutTRTRAboutTDTDAADIVDIVTDTDAboutSPANSPANIconImg_Txt_btnAboutAboutTDTDIMGIMGtoolbar_palettesep_6TDTDLog OutTABLETABLEbtnLogoffLog OutTBODYTBODYLog OutTRTRLog OutTDTDAADIVDIVTDTDLog OutSPANSPANIconImg_Txt_btnLogoffLog OutTRTRTDTDIFRAMEIFRAMEdataFrameIFRAMEIFRAMEautoNavFrameAAstartLink_iconMenu_menu_btnApplicationsAAendLink_iconMenu_menu_btnApplicationsAAstartLink_iconMenu_menu_btnApplicationsAAendLink_iconMenu_menu_btnApplications
> 2 = 454.464813265373
>Exit code: 0    Time: 18.96
 

Link to comment
Share on other sites

  • please post simplespy output as it will tell more then you think at the moment ;-)
    And as I assume you get a red rectangle around it its definitely clickable (but at the moment I think fully switching to IUIAutomation is to complex for you and not needed)
  • you should experiment with the different tags till you see the proper element text you are looking for.

Its almost impossible without a living site to see what you do wrong but based on what you posted so far no reason to think it cannot work.
I definitily see your element to click on its just how to get there. You could try to filter out all TD elements and their innertext. If found you can calculate location and click with mouseclick at that location.

<TD><A onclick="return YAHOO.widget.TreeView.getNode('ListingURE_treeContent_Inner',4).onLabelClick(YAHOO.widget.TreeView.getNode('ListingURE_treeContent_Inner',4))" onmouseover="document.getElementById('ygtvt4').className=YAHOO.widget.TreeView.getNode('ListingURE_treeContent_Inner',4).getHoverStyle()" onmouseout="document.getElementById('ygtvt4').className=YAHOO.widget.TreeView.getNode('ListingURE_treeContent_Inner',4).getStyle()" id=ygtvlabelel4 href="javascript:fireTreeNodeNavigationEvent({uniqueId:'23'}, getUniversalRepositoryExplorer('ListingURE'));" target=_self><SPAN id=ListingURE_treeNode4_name style="WHITE-SPACE: nowrap"><IMG id=ListingURE_treeNodeIcon_4 style="HEIGHT: 16px; WIDTH: 16px" border=0 alt="" src="https://InfoViewAppActions/ure/ure/cache/images/kind/Folder/Unexpanded.gif">&nbsp;Public Folders&nbsp;</SPAN></A></TD>

Summarized

  1. click on the Document List  works
  2. Next page comes (document list is gone) and on new page you try to click on Public Folders   --> not able to find/click on element

My feeling is you are dealing with some kind of caching or different frames as last program output you posted is not in sync with the html.txt you shared.

Link to comment
Share on other sites

I am not sure whether we can resolve this issue, as i have already provide the HTML page and below is the Public Folder page on which i have to click, if i am trying to right click for getting the inspect element that also i am not getting it means it is not HTML page. Let me know if i can provide any details. is there any way by which i can click on href.

image.png.b73c63ddc6384e62f320ba6161e42480.png

Link to comment
Share on other sites

By that only i sent last time element of this page. Below is the element:

 

<SPAN id=ListingURE_treeNode4_name style="WHITE-SPACE: nowrap"><IMG id=ListingURE_treeNodeIcon_4 style="HEIGHT: 16px; WIDTH: 16px" border=0 alt="" src="https:/InfoViewAppActions/ure/ure/cache/images/kind/Folder/Unexpanded.gif">&nbsp;Public Folders&nbsp;</SPAN>

Link to comment
Share on other sites

;Clicking on document list
$oSpan = _IEGetObjById($oFrame, "IconImg_Txt_btnListing")
_IEAction($oSpan, "click")

Sleep(2000)
Local $hWnd = WinWait("SAP BusinessObjects InfoView - Internet Explorer","",5)

Sleep(2000)

ControlClick($hWnd, "SAP BusinessObjects InfoView - Internet Explorer", "[CLASS:Internet Explorer_Server; INSTANCE:1]")

Sleep(2000)
;Clicking on Public Folder
$oFrame = _IEFrameGetCollection($oIE, 0)
$oSpan = _IEGetObjById($oFrame, "ListingURE_treeNode4_name")
_IEAction($oSpan, "click")

Above is the code but no result. I think there will be link or URL which will click on the Public Folder page.

Link to comment
Share on other sites

41 minutes ago, MRAJ said:

Above is the code but no result. I think there will be link or URL which will click on the Public Folder page.

If this code runs without any errors showing in the Scite output panel, then you've proven the following --

  • You've found the desired element
  • You're unable to trigger the necessary event(s) with _IEAction

If this is accurate, then I would suggest replacing the second instance of _IEAction with the following --

$iScreenX = _IEPropertyGet($oSpan, "screenx")
$iScreenY = _IEPropertyGet($oSpan, "screeny")
$iWidth = _IEPropertyGet($oSpan, "width")
$iHeight = _IEPropertyGet($oSpan, "height")

$iMousespeed = 30

$oMouseCords = MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed)
MouseClick($MOUSE_CLICK_LEFT)

 

Link to comment
Share on other sites

Below is the error in the output console:

 
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (ListingURE_treeNode4_name)
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
>Exit code: 0    Time: 21.41
 

Link to comment
Share on other sites

First you say this --

2 hours ago, MRAJ said:

Above is the code but no result. I think there will be link or URL which will click on the Public Folder page.

I give you a suggestion based on this information. Then you say this --

1 hour ago, MRAJ said:

Below is the error in the output console:
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (ListingURE_treeNode4_name)
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
>Exit code: 0    Time: 21.41

So your initial statement is inaccurate / lacking because you would have received this same exact errors.

Frankly, I feel like this entire thread has been a huge time waster. :(

Link to comment
Share on other sites

  • please post simplespy output as it will tell more then you think at the moment ;-)
    And as I assume you get a red rectangle around it its definitely clickable (but at the moment I think fully switching to IUIAutomation is to complex for you and not needed)
  • You could iterate the TABLE tags or TD tags and look if the innerText gives you the area where you are interested in
  • You should be aware on that potentially iFrames are involved so iterate on the different frames
  • Don´t post directly till you understand what we are trying to teach-telll you (as i am close to follow advice of @Earthshine)
  • and try this one (similar one as posted before) as is and then understand the output.
    After that change at the TODO in the code the things to your needs.
#include <ie.au3>
#include <Timers.au3>

_IEErrorHandlerRegister(_User_ErrFunc)

_Example()

Func _Example()
;~ TODO
    Local $oIE = _IECreate('https://www.w3.org/WAI/UA/TS/html401/cp0101/0101-FRAME-TEST.html', 0, 1, 0)
    Local $hStarttime = _Timer_Init()
    _IELoadWait($oIE)

    ConsoleWrite('> 1 = ' & _Timer_Diff($hStarttime) & @CRLF)

    _IELoadWait_ForAllFrames($oIE)

    Local $oFrames = _IEFrameGetCollection($oIE)
    Local $iNumFrames = @extended
    Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
    Local $oFrame = 0

    consolewrite($sTxt)
    
    For $i = 0 To ($iNumFrames - 1)
        $oFrame = _IEFrameGetCollection($oIE, $i)
        local $oElements

;~         local $tagType="td"
;~      local $tagType="span"
        
;~         $oElements=$oframe.document.getElementsByTagName($tagType)       
;~         consolewrite("Hooray we found " & $oElements.length & " elements of type " & $tagType & @CRLF)
        
;~ Now dump all tags regardless of type     
        $oElements = _IETagNameAllGetCollection ($oFrame)
        For $oElement In $oElements
          consolewrite($oElement.tagname & stringleft($oElement.innerText,10))
;~ TODO
;~          If stringinstr($oElement.innerText,"Public Folders",false)>0 Then
            If stringinstr($oElement.innerText,"link 2",false)>0 Then
                consolewrite("***************** H O O R A Y ***********" & @CRLF)           
            EndIf
        Next
        consolewrite(@CRLF)

    Next

    ConsoleWrite('> 2 = ' & _Timer_Diff($hStarttime) & @CRLF)
;~     _IEQuit($oIE)
EndFunc   ;==>_Example


Func _IELoadWait_ForAllFrames(ByRef $oObject, $iDelay = 0, $iTimeout = Default)
    _IELoadWait($oObject, $iDelay, $iTimeout)
    If @error Then Return SetError(@error, @extended, -1)

    Local $oFrames_coll = _IEFrameGetCollection($oObject)
    #forceref $oFrames_coll
    Local $iNumFrames = @extended
    Local $oFrame = Null
    For $iFrame_idx = 0 To ($iNumFrames - 1)
        $oFrame = _IEFrameGetCollection($oObject, $iFrame_idx)
        _IEDocGetObj($oFrame)
        If Not @error Then
            _IELoadWait($oFrame, $iDelay, $iTimeout)
            If @error Then Return SetError(@error, @extended, -1)
        EndIf
    Next

    Return SetError($_IESTATUS_Success, 0, 1)

EndFunc   ;==>_IELoadWait_ForAllFrames


; User's COM error function.
Func _User_ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptFullPath & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_User_ErrFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...