Jump to content

_IEDocReadHTML is not returning HTML


Go to solution Solved by libreau3,

Recommended Posts

Hello All

      I am attempt ting to retrieve the rates for a particular hotel, but after creating the IE object and clicking the search button I can not retrieve the the html. _IEDocReadHtml() is setting the @error to 0. Does anyone know why this is happening?

#include <File.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>

SplashTextOn("", "Please Wait!", 200, 50)

Local $oIE = _IECreate("http://book.bestwestern.com/bestwestern/US/PA/Carbondale-hotels/BEST-WESTERN-Pioneer-Plaza/Hotel-Overview.do?propertyCode=39127")
Local $checkAvail = _IEGetObjById($oIE, "searchBtn")
_IEAction($checkAvail, "click")
_IELoadWait($oIE)
Local $sHTML = _IEDocReadHTML($oIE)
FileWrite(@DesktopDir & "\Temp.html", $sHTML)
_IEQuit($oIE)
$html = ""
_FileReadToArray(@DesktopDir & "\temp.html", $html)
Global $span
For $I = 0 To UBound($html) - 1
    If StringInStr($html[$I], '<span class="currencyRateDisplay">') Then
        ConsoleWrite($html[$I])
        $temp = _StringBetween($html[$I], '<span class="currencyRateDisplay">', '</span>')
        $span &= $temp[0] & "|"
        ConsoleWrite($temp[0]& @CRLF)
    Else 
        ContinueLoop
    EndIf
Next
$span = StringSplit($span, "|", 2)
_ArraySort($span)
_ArrayDisplay($span)
FileDelete(@DesktopDir & "\temp.html")
If IsArray($span) = 0 Or UBound($span) < 2 Then
    IniWrite(@DesktopDir & "\hotel.ini", "Nicholas Village Clarks Summit", "Min", "Sold Out")
    IniWrite(@DesktopDir & "\hotel.ini", "Nicholas Village Clarks Summit", "Max", "Sold Out" & @CRLF)

Else
    IniWrite(@DesktopDir & "\hotel.ini", "Nicholas Village Clarks Summit", "Min", $span[1])
    IniWrite(@DesktopDir & "\hotel.ini", "Nicholas Village Clarks Summit", "Max", $span[UBound($span) - 1] & @CRLF)
EndIf
$span = ""


;~ ;Clean Up
SplashOff()
ShellExecute(@DesktopDir & "\hotel.ini")
WinWaitActive("hotel.ini - Notepad", "")
WinSetState("hotel.ini - Notepad", "", @SW_MAXIMIZE)
WinWaitClose("hotel.ini - Notepad", "")
FileDelete(@DesktopDir & "\hotel.ini")
Link to comment
Share on other sites

My bad I posted the wrong segment of code.

#include <File.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>

SplashTextOn("", "Please Wait!", 200, 50)

Local $oIE = _IECreate("https://www.msiwebbooking.com/production/default.aspx?id=eb737f64-5b38-496b-b1eb-00f5d2715e92")
$checkAvail = _IEGetObjById($oIE, "ctl00_ContentPlaceHolder1_ImageButton4")
_IEAction($checkAvail, "click")
Sleep(3000)
$load = _IELoadWait($oIE)
Local $sHTML = _IEDocReadHTML($oIE)
FileWrite(@DesktopDir & "\Temp.html", $sHTML)
_IEQuit($oIE)
$html = 0
_FileReadToArray(@DesktopDir & "\temp.html", $html)
Global $span
For $I = 0 To UBound($html) - 1
    If StringInStr($html[$I], '<span id="ctl00_ContentPlaceHolder1_ctl05_lblRoomRateValue" class="accordionText">') Then
        ConsoleWrite($html[$I])
        $temp = _StringBetween($html[$I], '<span id="ctl00_ContentPlaceHolder1_ctl05_lblRoomRateValue" class="accordionText">', '</span>')
        $span &= $temp[0] & "|"
        ConsoleWrite($temp[0]& @CRLF)
    Else
        ContinueLoop
    EndIf
Next
$span = StringSplit($span, "|", 2)
_ArraySort($span)
_ArrayDisplay($span)
FileDelete(@DesktopDir & "\temp.html")
If IsArray($span) = 0 Or UBound($span) < 2 Then
    IniWrite(@DesktopDir & "\hotel.ini", "Nicholas Village Clarks Summit", "Min", "Sold Out")
    IniWrite(@DesktopDir & "\hotel.ini", "Nicholas Village Clarks Summit", "Max", "Sold Out" & @CRLF)

Else
    IniWrite(@DesktopDir & "\hotel.ini", "Nicholas Village Clarks Summit", "Min", $span[1])
    IniWrite(@DesktopDir & "\hotel.ini", "Nicholas Village Clarks Summit", "Max", $span[UBound($span) - 1] & @CRLF)
EndIf
$span = ""



;~ ;Clean Up
SplashOff()
ShellExecute(@DesktopDir & "\hotel.ini")
WinWaitActive("hotel.ini - Notepad", "")
WinSetState("hotel.ini - Notepad", "", @SW_MAXIMIZE)
WinWaitClose("hotel.ini - Notepad", "")
FileDelete(@DesktopDir & "\hotel.ini")
Edited by libreau3
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...