RobZ Posted October 20, 2009 Share Posted October 20, 2009 Hi all newbie Question here, all assistance appreciated. trying to automate the download of a report from sql Reporting Services. I can: a)create the ie browser (and load the page) b)fill in the required fields c) run the report. d) wait for the page to reload (the report data to be added to the page). the page then loads ( via ajax ) and appends the data into the bottom of the body. also then the report shows export options ( i want to use CSV). my problem: when i run the _IEBodyReadHTML($oIE) function after the page has reloaded, the original content of the body is returned! (same as after point a) above) The export controls and the actual report data is not returned by the function.(although they are visible on the page, and can be found when viewing page source) is there a way i can "refresh" the handler to the page "$oIE" to reflect the added controls & data? below is the Code : #include <IE.au3> #include <Date.au3> #include <Constants.au3> ; Load the report ------------------------------------------------------------ $oIE = _IECreate("http://xxxxxxxxxxx/Reports/Pages/Report.aspx?ItemPath=%2fTest%2fResource+Actuals+For+Projects") $oForm = _IEFormGetObjByName($oIE, "ui_form") ; --- find the cost centre Drop Down $oSelect = _IEFormElementGetObjByName($oForm, "ctl139_ctl00_ctl05_ddValue") ; --- select our cost Centre _IEFormElementOptionselect($oSelect, "14", 1, "byValue") ; --- find report date start TextBox $oDateStart = _IEFormElementGetObjByName($oForm, "ctl139_ctl00_ctl07_txtValue") ; --- set the start Date _IEFormElementSetValue($oDateStart, "2009-01-01") ; --- find the report end date $oDateEnd = _IEFormElementGetObjByName($oForm, "ctl139_ctl00_ctl09_txtValue") ; --- set the date _IEFormElementSetValue($oDateEnd, "2009-02-02") ; --- Click the 'run report button' -- Button to run Report ctl139_ctl00_ctl00 $oBtnrunReport = _IEFormElementGetObjByName($oForm, "ctl139_ctl00_ctl00") _IEAction($oBtnrunReport, "click") ; --- wait for report to be rendered _IELoadWait($oIE) ; --- at this stage, report has rendered, grab the html of the page $sHTML = _IEBodyReadHTML ($oIE) ; --- search for Employee Number / dump html to console - result = no report data is visible in the html source ConsoleWrite($sHTML & @CRLF) ; _IEQuit ($oIE) thanks in advance Rob Link to comment Share on other sites More sharing options...
ame1011 Posted October 20, 2009 Share Posted October 20, 2009 does the page display with javascript disabled? Some websites have a non-javascript version. If it does try disabling javascript with: RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\", "1400", "REG_DWORD" , 3) and re-enabling it with: RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\", "1400", "REG_DWORD" , 0) after your script is done [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font] 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