MRAJ Posted May 15, 2018 Author Share Posted May 15, 2018 As i am new to autoit and not having depth knowledge..if you can share the script in the zip file which i want for my script to run and click on the Public Folder page that will help me to resolve the issue. Link to comment Share on other sites More sharing options...
junkew Posted May 15, 2018 Share Posted May 15, 2018 ok forget iuiautomation ./ zip and just run my shared example from scite and try to understand what its doing. Then use the last part of that example to iterate over the span elements of your own page. In general you should see your mouse moving over all your span controls and try to click at them. And last but not least study first the notepad examples in the help files to understand the general concepts of finding elements and doing actions on them. Its just hard to learn directly IE.UDF (or worse selenium/webbrowser udf) if you do not understand the internal developer tools of a browser or how to work with a (shadow) DOM tree. Danp2 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
MRAJ Posted May 15, 2018 Author Share Posted May 15, 2018 You mean to say below part of the script to run in my script: local $spanElements $spanElements=$oie.document.getElementsByTagName("span") consolewrite("Hooray we found " & $spanElements.length & " elements") local $el ;~ local $boundingRect for $i=8 to 0 step -2 $el=$spanelements.item($i) ;~ $boundingRect=$el.getboundingclientrect() local $x=_IEPropertyGet($el, "screenx") local $y=_IEPropertyGet($el, "screeny") mousemove($x, $y) mouseclick("left", $x,$y) sleep(200) Next Link to comment Share on other sites More sharing options...
MRAJ Posted May 15, 2018 Author Share Posted May 15, 2018 Local $oIE = _IECreate($URL,0,1) Sleep(5000) Local $hWnd = WinWait("InfoView - Internet Explorer","",5) Sleep(2000) ControlClick($hWnd, "InfoView - Internet Explorer", "[CLASS:Internet Explorer_Server; INSTANCE:1]") Sleep(2000) Send("{TAB}username{TAB}{TAB}Password{ENTER}") Sleep(5000) ;script for clicking on Document List $oFrame = _IEFrameGetCollection($oIE, 0) $oSpan = _IEGetObjById($oFrame, "IconImg_Txt_btnListing") _IEAction($oSpan, "click") Sleep(5000) ;which part of script to put from the shared example to click on Public Folder Above is my script. Please let me know which part of script to put from the shared example to click on Public Folder. Link to comment Share on other sites More sharing options...
junkew Posted May 15, 2018 Share Posted May 15, 2018 Yes merge code of your previous 2 posts FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
junkew Posted May 15, 2018 Share Posted May 15, 2018 And study https://www.w3schools.com/jsref/met_element_getelementsbytagname.asp For example length property $spanElements.length FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
MRAJ Posted May 16, 2018 Author Share Posted May 16, 2018 Could you please give me complete code of combination of my script and your sample script which you told to combine. For me it is giving error. expandcollapse popupLocal $oIE = _IECreate($URL,0,1) Sleep(5000) Local $hWnd = WinWait("InfoView - Internet Explorer","",5) Sleep(2000) ControlClick($hWnd, "InfoView - Internet Explorer", "[CLASS:Internet Explorer_Server; INSTANCE:1]") Sleep(2000) Send("{TAB}username{TAB}{TAB}Password{ENTER}") Sleep(5000) ;script for clicking on Document List $oFrame = _IEFrameGetCollection($oIE, 0) $oSpan = _IEGetObjById($oFrame, "IconImg_Txt_btnListing") _IEAction($oSpan, "click") Sleep(5000) local $spanElements $spanElements=$oie.document.getElementsByTagName("span") consolewrite("Hooray we found " & $spanElements.length & " elements") local $el ;~ local $boundingRect for $i=8 to 0 step -2 $el=$spanelements.item($i) ;~ $boundingRect=$el.getboundingclientrect() local $x=_IEPropertyGet($el, "screenx") local $y=_IEPropertyGet($el, "screeny") mousemove($x, $y) mouseclick("left", $x,$y) sleep(200) Next Below is the error code: Hooray we found 0 elements--> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType >Exit code: 0 Time: 23.67 Link to comment Share on other sites More sharing options...
Danp2 Posted May 16, 2018 Share Posted May 16, 2018 1 hour ago, MRAJ said: Hooray we found 0 elements This means that there weren't any SPAN elements found, so either -- the webpage hadn't fully loaded the elements are located within a frame Since we don't have access to the website, you are the only one that can figure out why it isn't working. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
junkew Posted May 16, 2018 Share Posted May 16, 2018 expandcollapse popupLocal $oIE = _IECreate($URL,0,1) Sleep(5000) Local $hWnd = WinWait("InfoView - Internet Explorer","",5) Sleep(2000) ControlClick($hWnd, "InfoView - Internet Explorer", "[CLASS:Internet Explorer_Server; INSTANCE:1]") Sleep(2000) Send("{TAB}username{TAB}{TAB}Password{ENTER}") Sleep(5000) ;script for clicking on Document List $oFrame = _IEFrameGetCollection($oIE, 0) Local $iNumFrames = @extended consolewrite("Hooray we found " & $iNumFrames & " frames") $oSpan = _IEGetObjById($oFrame, "IconImg_Txt_btnListing") _IEAction($oSpan, "click") Sleep(5000) local $spanElements $spanElements=$oie.document.getElementsByTagName("span") consolewrite("Hooray we found " & $spanElements.length & " elements") local $el ;~ local $boundingRect for $i=8 to 0 step -2 $el=$spanelements.item($i) ;~ $boundingRect=$el.getboundingclientrect() local $x=_IEPropertyGet($el, "screenx") local $y=_IEPropertyGet($el, "screeny") mousemove($x, $y) mouseclick("left", $x,$y) sleep(200) Next I added this Local $iNumFrames = @extended consolewrite("Hooray we found " & $iNumFrames & " frames") FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
MRAJ Posted May 17, 2018 Author Share Posted May 17, 2018 Below the output i found after runnning the above script. expandcollapse popupLocal $oIE = _IECreate($URL,0,1) Sleep(5000) Local $hWnd = WinWait("InfoView - Internet Explorer","",5) Sleep(2000) ControlClick($hWnd, "InfoView - Internet Explorer", "[CLASS:Internet Explorer_Server; INSTANCE:1]") Sleep(2000) Send("{TAB}username{TAB}{TAB}Password{ENTER}") Sleep(5000) ;script for clicking on Document List $oFrame = _IEFrameGetCollection($oIE, 0) Local $iNumFrames = @extended consolewrite("Hooray we found " & $iNumFrames & " frames") $oSpan = _IEGetObjById($oFrame, "IconImg_Txt_btnListing") _IEAction($oSpan, "click") Sleep(5000) Local $iNumFrames = @extended consolewrite("Hooray we found " & $iNumFrames & " frames") local $spanElements $spanElements=$oie.document.getElementsByTagName("span") consolewrite("Hooray we found " & $spanElements.length & " elements") local $el ;~ local $boundingRect for $i=8 to 0 step -2 $el=$spanelements.item($i) ;~ $boundingRect=$el.getboundingclientrect() local $x=_IEPropertyGet($el, "screenx") local $y=_IEPropertyGet($el, "screeny") mousemove($x, $y) mouseclick("left", $x,$y) sleep(200) Next Hooray we found 1 framesHooray we found 0 framesHooray we found 0 elements--> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType >Exit code: 0 Time: 23.33 Link to comment Share on other sites More sharing options...
junkew Posted May 17, 2018 Share Posted May 17, 2018 (edited) maybe page not loaded yet https://www.autoitscript.com/autoit3/docs/libfunctions/_IELoadWait.htm try to add this it will dump any tag it can find $oElements = _IETagNameAllGetCollection ($oIE) For $oElement In $oElements consolewerite($oElement.tagname) Next Edited May 17, 2018 by junkew FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
MRAJ Posted May 17, 2018 Author Share Posted May 17, 2018 Local $iNumFrames = @extended consolewrite("Hooray we found " & $iNumFrames & " frames") $oSpan = _IEGetObjById($oFrame, "IconImg_Txt_btnListing") _IEAction($oSpan, "click") Sleep(5000) Local $iNumFrames = @extended consolewrite("Hooray we found " & $iNumFrames & " frames") local $spanElements $spanElements=$oie.document.getElementsByTagName("span") consolewrite("Hooray we found " & $spanElements.length & " elements") $oElements = _IETagNameAllGetCollection ($oIE) For $oElement In $oElements consolewrite($oElement.tagname) Next local $el ;~ local $boundingRect for $i=8 to 0 step -2 $el=$spanelements.item($i) ;~ $boundingRect=$el.getboundingclientrect() local $x=_IEPropertyGet($el, "screenx") local $y=_IEPropertyGet($el, "screeny") mousemove($x, $y) mouseclick("left", $x,$y) sleep(200) Next I tried and got the below output: Hooray we found 1 framesHooray we found 0 framesHooray we found 0 elements!HTMLHEADTITLELINKSCRIPTSCRIPTFRAMESETFRAME--> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType >Exit code: 0 Time: 23.69 Link to comment Share on other sites More sharing options...
Earthshine Posted May 17, 2018 Share Posted May 17, 2018 Without ever getting to look at the web pages in question we can only guess My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2018 Share Posted May 17, 2018 40 minutes ago, MRAJ said: HTMLHEADTITLELINKSCRIPTSCRIPTFRAMESETFRAME This proves that these SPAN elements don't exist on the primary web page, so they must be in the frame. Honestly, it shouldn't take 75+ responses in a forum to figure that out. I find it difficult to understand why you haven't resolved this by now. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MRAJ Posted May 17, 2018 Author Share Posted May 17, 2018 Let me know if you need any info or HTML page for this. Link to comment Share on other sites More sharing options...
MRAJ Posted May 17, 2018 Author Share Posted May 17, 2018 so what will be the frame code to resolve this issue. Please help me with script. Link to comment Share on other sites More sharing options...
MRAJ Posted May 17, 2018 Author Share Posted May 17, 2018 I found only this frame on the Public Folder page. Link to comment Share on other sites More sharing options...
junkew Posted May 17, 2018 Share Posted May 17, 2018 Indeed many posts to get OP in the right direction. @MRAJ as we do not have access to your html page its hard to help. If you are less experienced with HTML / FRAMES etc. then it can take a while to learn. It then could be easier to use IUIAutomation but the will also have its own challenges as thats also not a simple library. see https://www.w3schools.com/tags/tag_frameset.asp so you have a few nested frames and each frame has its own document (which in worst case can have again frames) this thread can help see example on counting frames over there: FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
MRAJ Posted May 17, 2018 Author Share Posted May 17, 2018 (edited) Attached is HTML page of the application. Edited May 17, 2018 by MRAJ Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2018 Share Posted May 17, 2018 So now we've circled back to here. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now