Maffe811 Posted October 25, 2013 Share Posted October 25, 2013 (edited) http://www.bkr.se/sok-plattsattare.aspx Lower down in this link ^ there is a table and if you click each company (example "Kimstad Bygg AB") a window will popup and give you info. Im trying to get this info into a variable in the first place. Problem is that the clicking of the link is part of jquery and inspecting element in chrome on the info window takes me to a different page than doing that on the background. Im really confused on how to get the info form one info window, then close and click the next company and get the next info out of the next info window. Any suggestions ? Edited October 25, 2013 by Maffe811 [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
Gianni Posted October 26, 2013 Share Posted October 26, 2013 Hi Maffe811 an example (a bit messy) on how to extract data from the first 10 pages for the other pages,.... find a way by yourself expandcollapse popup#include <IE.au3> #include <Array.au3> ; open the page Local $oIE = _IECreate("http://www.bkr.se/sok-plattsattare.aspx") Local $oTable = _IETableGetCollection($oIE, 2) ; second table contains nr. of pages Local $aTableData = _IETableWriteToArray($oTable) ; put the list from web table to array ; _ArrayDisplay($aTableData) #cs ; ----- to see all the links on the page ----- ; the link number can be used in _IELinkClickByIndex($oIE, $index) Local $index = 0 Local $oLinks = _IELinkGetCollection($oIE) ; For $oLink In $oLinks ; print all links of the page ConsoleWrite($index & " Link Info:"& $oLink.href&@CRLF) $index += 1 Next #ce ; ---------------------------------------------- For $pages = 1 To UBound($aTableData) - 1 ; the links of the items on the web page are from link index 46 to link index 65 For $rows = 46 To 65 _IELinkClickByIndex($oIE, $rows) ; click on the rows (links) Local $oPopupTable = "" Local $aTableData = "" ; give explorer some time to built the popup Sleep(1000) Do ; be sure that the table inside the popup is ready Local $oPopupTable = _IEGetObjById($oIE, "ctl00_ctl00_cphMain_twAreaContentPlaceHolder6_ctrlMemberCompanySearch808_fvCompany") ; table inside the popup Until IsObj($oPopupTable) ; the fields in the popup are all in one single string separated by variable chrlf sequences Local $aTableData = _IETableWriteToArray($oPopupTable, True) ; copy the table elements into an array (only one element) ; _ArrayDisplay($aTableData) ; remove all duplicates crlf so that only one crlf remain between fields Do Do $aTableData[0][0] = StringReplace($aTableData[0][0], Chr(13) & Chr(10) & Chr(13) & Chr(10), Chr(13) & Chr(10)) ; ConsoleWrite(@extended & @CRLF) Until Not @extended $aTableData[0][0] = StringReplace($aTableData[0][0], Chr(13) & Chr(10) & Chr(13) & Chr(10), Chr(13) & Chr(10)) Until Not @extended $aTableData[0][0] = StringReplace($aTableData[0][0], ":" & Chr(13) & Chr(10), ":") ; replace separator between fieldname and fielddata with ":" $temp = "" $temp = StringSplit($aTableData[0][0], Chr(13) & Chr(10), 3) ; split string elements into an array ; _ArrayDisplay($temp) ; print elements OR MANAGE AS YOU LIKE For $i = 0 To UBound($temp) - 1 ConsoleWrite($temp[$i] & @TAB) Next ConsoleWrite(@CRLF) Local $oStang = _IEGetObjById($oIE, "ctl00_ctl00_cphMain_twAreaContentPlaceHolder6_ctrlMemberCompanySearch808_btnClose") ; button "Stang" _IEAction($oStang, "click") ; click on button to close the popup Sleep(1000) ; give some time to clear the table Next _IELinkClickByIndex($oIE, $pages + 65) ; next page (links from index 66 to index 75 opens next pages) Next bye Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Maffe811 Posted October 26, 2013 Author Share Posted October 26, 2013 I see you used _IEGetObjById to get the table, i tried the same but i think i tried to get it by class. But this is really amazing. Thank you very much! I'll keep working with it! Thanks again! [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
Gianni Posted October 26, 2013 Share Posted October 26, 2013 glad to be of help bye Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... 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