oemript Posted April 14, 2019 Share Posted April 14, 2019 Referring to following link, I would like to know on whether it is possible to capture text into text / csv file as shown below https://www.hkab.org.hk/DisplayInterestSettlementRatesAction.do?lang=en Does anyone have any suggestions? Thanks in advance for any suggestions Link to comment Share on other sites More sharing options...
Nine Posted April 14, 2019 Share Posted April 14, 2019 You can do it quite easily with IE.au3 UDF. Look at help file. Especially IEGetTagCollection...Start with the example, and bring it to the web site of your choice “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
oemript Posted April 15, 2019 Author Share Posted April 15, 2019 IEGetTagCollection is not available on version v3.3.14.3 SciTE Do you have any suggestions on which version should be tried? Thank you very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
Danp2 Posted April 15, 2019 Share Posted April 15, 2019 The correct function name is IETagNameGetCollection Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
oemript Posted April 15, 2019 Author Share Posted April 15, 2019 Referring to following coding, I would like to know on how to locate text and display on message box using IETagNameGetCollection. Does anyone have any suggestions? Thanks, to everyone very much for any suggestions (^v^) #include <IE.au3> #include <MsgBoxConstants.au3> While ProcessExists("iexplore.exe") ProcessClose("iexplore.exe") WEnd Global $oIE = _IECreate("https://www.hkab.org.hk/DisplayInterestSettlementRatesAction.do?lang=en") Sleep(5000) ;~ Wait while page loads Local $oInputs = _IETagNameGetCollection($oIE, "input") Local $sTxt = "" For $oInput In $oInputs $sTxt &= $oInput.type & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Form Input Type", "Form: " & $oInput.form.name & @CRLF & @CRLF & " Types :" & @CRLF & $sTxt) Link to comment Share on other sites More sharing options...
Danp2 Posted April 15, 2019 Share Posted April 15, 2019 Use the browser's built-in Developer Tools to examine the website. This is an essential skill if you want to automate websites. By examining this site, you would learn -- The website uses frames The data you see is held inside a table So, you first need to use switch to the correct frame using _IEFrameGetCollection. Then you should be able to access the table's data using _IETableGetCollection / _IETableWriteToArray. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted April 15, 2019 Share Posted April 15, 2019 @oemript You first need to access the frame named "out". Use the func to get the frame object directly : _IEFrameGetObjByName () The tags you want to access are under "td". Modify your code accordingly and you will see the data in your MsgBox... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
oemript Posted April 15, 2019 Author Share Posted April 15, 2019 (edited) Referring to following image, I would like to know on how to access 6 months and 2.04536 by _IETagNameGetCollection, on the other words, what Name should be used for matching in order to retrieve required texts. Do you have any example? Thanks, to everyone very much for any suggestions (^v^) Edited April 15, 2019 by oemript Link to comment Share on other sites More sharing options...
Nine Posted April 15, 2019 Share Posted April 15, 2019 Try this : #include <Constants.au3> #include <IE.au3> #include <Array.au3> Opt ("MustDeclareVars", 1) Local $oIE = _IECreate("https://www.hkab.org.hk/DisplayInterestSettlementRatesAction.do?lang=en") If Not IsObj ($oIE) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error creating IE object") Local $oFrame = _IEFrameGetObjByName ($oIE,"out") If Not IsObj ($oFrame) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error searching for frame") Local $oTDs = _IETagNameGetCollection ($oFrame, "td") If Not IsObj ($oTDs) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error gathering tag collection") Local $sValue For $oTD in $oTDs $sValue = _IEPropertyGet ($oTD, "innertext") If @error or $sValue = "" Then ContinueLoop If $sValue = "6 Months" Then $sValue = $oTD.nextElementSibling.innerText ExitLoop Endif Next MsgBox ($MB_SYSTEMMODAL,"",Number($sValue)) _IEQuit ($oIE) oemript 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
oemript Posted April 16, 2019 Author Share Posted April 16, 2019 Thanks, to everyone very much for suggestions (^v^) Link to comment Share on other sites More sharing options...
oemript Posted April 20, 2019 Author Share Posted April 20, 2019 Referring to following coding and image, if oFrame is not available, I would like to know on what to look for based on following image. Do you have any suggestions? Thank you very much for any suggestions (^v^) #include <Constants.au3> #include <IE.au3> #include <Array.au3> Opt ("MustDeclareVars", 1) Local $oIE = _IECreate("https://www.cmegroup.com/trading/interest-rates/countdown-to-fomc.html") If Not IsObj ($oIE) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error creating IE object") Local $oFrame = _IEFrameGetObjByName ($oIE,"out") If Not IsObj ($oFrame) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error searching for frame") Local $oTDs = _IETagNameGetCollection ($oFrame, "td") If Not IsObj ($oTDs) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error gathering tag collection") Local $sValue For $oTD in $oTDs $sValue = _IEPropertyGet ($oTD, "innertext") If @error or $sValue = "" Then ContinueLoop If $sValue = "200-225" Then $sValue = $oTD.nextElementSibling.innerText ;which return 0.0% $sValue = $oTD.nextElementSibling.innerText ;which return 2.0% $sValue = $oTD.nextElementSibling.innerText ;which return 3.9% ExitLoop Endif Next MsgBox ($MB_SYSTEMMODAL,"",Number($sValue)) _IEQuit ($oIE) Link to comment Share on other sites More sharing options...
Danp2 Posted April 20, 2019 Share Posted April 20, 2019 This is the definition for the frame you referenced in the image -- <iframe src="https://cmegroup-tools.quikstrike.net/User/QuikStrikeTools.aspx?viewitemid=IntegratedFedWatchTool" style="width: 100%; height: 885px; overflow: hidden; border: 0px none;" scrolling="no" id="cmeIframe-yoymbhus" class="cmeIframe" frameborder="0"></iframe> It doesn't have a given name, so using _IEFrameGetObjByName is not an option. But you still need to get a reference to the frame object in order to access it contents. You can use _IEFrameGetCollection with an index value (I believe 0 will work in this case ) or you could use _IEGetObjById, Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted April 20, 2019 Share Posted April 20, 2019 @Danp2 Id is always changing. And for some reason _IEFrameGetCollection doesn't work for that site. Only way I was able to access it is by using this code : #include <IE.au3> Opt ("MustDeclareVars", 1) Local $oIE = _IECreate("https://www.cmegroup.com/trading/interest-rates/countdown-to-fomc.html") If Not IsObj ($oIE) Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error creating IE object") Local $oFrames = _IEFrameGetCollection ($oIE) ConsoleWrite ("Number of frames : " & $oFrames.length & @CRLF) For $oFrame in $oFrames ConsoleWrite (ObjName ($oFrame) & @CRLF) ; it doesn't write anything Next Local $oDivs = _IETagNameGetCollection ($oIE, "div") Local $oObject For $oDiv in $oDivs if $oDiv.className = " cmeIframeContainer" then ConsoleWrite ($oDiv.className & @CRLF) $oObject = $oDiv.firstElementChild ExitLoop EndIf Next MsgBox ($MB_SYSTEMMODAL,"",ObjName($oObject) & "/" & $oObject.id) But then the frame object seems empty, no tagcollection is working, empty... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Danp2 Posted April 20, 2019 Share Posted April 20, 2019 @Nine I believe the issue is related to browser restrictions limiting access to cross-domain elements. I was actually able to make it work by navigating to the domain that contains the desired data -- #include <IE.au3> #include <array.au3> $oIE = _IECreate("https://www.cmegroup.com/trading/interest-rates/countdown-to-fomc.html") _IENavigate($oIE, "https://cmegroup-tools.quikstrike.net/User/QuikStrikeView.aspx?viewitemid=IntegratedFedWatchTool") $oTable = _IETableGetCollection($oIE, 4) $aData = _IETableWriteToArray($oTable) _ArrayDisplay($aData) Nine and oemript 1 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
oemript Posted April 28, 2019 Author Share Posted April 28, 2019 (edited) On 4/21/2019 at 12:39 AM, Danp2 said: @Nine I believe the issue is related to browser restrictions limiting access to cross-domain elements. I was actually able to make it work by navigating to the domain that contains the desired data -- #include <IE.au3> #include <array.au3> $oIE = _IECreate("https://www.cmegroup.com/trading/interest-rates/countdown-to-fomc.html") _IENavigate($oIE, "https://cmegroup-tools.quikstrike.net/User/QuikStrikeView.aspx?viewitemid=IntegratedFedWatchTool") $oTable = _IETableGetCollection($oIE, 4) $aData = _IETableWriteToArray($oTable) _ArrayDisplay($aData) Referring to following image, I would like to know on how to click specific tabs in order to retrieve data for different months. javascript:__doPostBack('ctl00$MainContent$ucViewControl_IntegratedFedWatchTool$uccv$lvMeetings$ctrl0$lbMeeting','') javascript:__doPostBack('ctl00$MainContent$ucViewControl_IntegratedFedWatchTool$uccv$lvMeetings$ctrl1$lbMeeting','') javascript:__doPostBack('ctl00$MainContent$ucViewControl_IntegratedFedWatchTool$uccv$lvMeetings$ctrl2$lbMeeting','') javascript:__doPostBack('ctl00$MainContent$ucViewControl_IntegratedFedWatchTool$uccv$lvMeetings$ctrl3$lbMeeting','') javascript:__doPostBack('ctl00$MainContent$ucViewControl_IntegratedFedWatchTool$uccv$lvMeetings$ctrl4$lbMeeting','') javascript:__doPostBack('ctl00$MainContent$ucViewControl_IntegratedFedWatchTool$uccv$lvMeetings$ctrl5$lbMeeting','') javascript:__doPostBack('ctl00$MainContent$ucViewControl_IntegratedFedWatchTool$uccv$lvMeetings$ctrl6$lbMeeting','') Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Edited April 28, 2019 by oemript Link to comment Share on other sites More sharing options...
Danp2 Posted April 28, 2019 Share Posted April 28, 2019 2 hours ago, oemript said: I would like to know on how to click specific tabs in order to retrieve data for different months. Do you have any suggestions? You should be able to use the same technique you quoted above. Navigate to the page and then to the actual frame location. From there, you shouldn't have any issues with clicking the desired link. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
oemript Posted April 29, 2019 Author Share Posted April 29, 2019 (edited) Referring to following coding, within the same Frame, there is no specific name to locate following coding. javascript:__doPostBack('ctl00$MainContent$ucViewControl_IntegratedFedWatchTool$uccv$lvMeetings$ctrl1$lbMeeting','') The closer related location is this coding <div id="MainContent_pnlContrainer">, but I don't know on how to relate clicking to specific tab. Do you have any suggestions on how to call above script and click tab? so it would display information on 19 Jun 19. Thanks, to everyone very much for any suggestions (^v^) Edited April 29, 2019 by oemript Link to comment Share on other sites More sharing options...
Nine Posted April 29, 2019 Share Posted April 29, 2019 You can use the id of the tab directly with something like this : $oTag = _IEGetObjById ($oIE, "ctl00_MainContent_ucViewControl_IntegratedFedWatchTool_uccv_lvMeetings_ctrl1_lbMeeting") _IEAction ($oTag, "click") _IELoadWait ($oIE) Each tab has its own number if you look carefully the ids... Danp2 and oemript 1 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
oemript Posted April 30, 2019 Author Share Posted April 30, 2019 Referring to following coding, I would like to know on what following do, since I already select 18 Sep 19 Tab, but the $oTable still retrieve data from 1 May 19 tab Do you have any suggestions on why IETableGetCollection do not able to update content? Thanks, to everyone very much for any suggestions (^v^) #include <IE.au3> #include <array.au3> $oIE = _IECreate("https://www.cmegroup.com/trading/interest-rates/countdown-to-fomc.html") _IENavigate($oIE, "https://cmegroup-tools.quikstrike.net/User/QuikStrikeView.aspx?viewitemid=IntegratedFedWatchTool") $oTag = _IEGetObjById ($oIE, "ctl00_MainContent_ucViewControl_IntegratedFedWatchTool_uccv_lvMeetings_ctrl3_lbMeeting") _IEAction ($oTag, "click") _IELoadWait ($oIE) $oTable = _IETableGetCollection($oIE, 4) ; What does it do? $aData = _IETableWriteToArray($oTable) _ArrayDisplay($aData) Link to comment Share on other sites More sharing options...
Danp2 Posted April 30, 2019 Share Posted April 30, 2019 5 hours ago, oemript said: Do you have any suggestions on why IETableGetCollection do not able to update content? Because the data hasn't finished refreshing. Add a Sleep command or use the delay option of _IELoadWait. oemript 1 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