souldjer777

Trying to get html source from website that uses Java

3 posts in this topic

#1 ·  Posted (edited)

Good Morning All AutoIT Gurus,

 :ILA2:

Does anyone know how I can get the right responses for Inet.au3 or IE.au3 for sites that check your browser, os, etc using Javascript? For some reason the source is empty using the built-in tools in AutoIT... doesn't contain the version information when reading using inetgetsource or iedocreadhtml ... The point is to find out the latest version automatically using AutoIT tools. 

Example: https://get.adobe.com/flashplayer/

#include <Inet.au3>
$OpenHTML01 = _INetGetSource("https://get.adobe.com/flashplayer/")
MsgBox (0, "", $OpenHTML01)

A typical page response would include...

"Version 18.0.0.232
System requirements"

... within the <div id="autoSelectedVersion"> tag.

Thanks!!!

:huh2:

UPDATE: I believe it's this file that determines what OS, language, x32, x64, browser, etc that you are using and then reports it back...
https://wwwimages2.adobe.com/downloadcenter/js/live/polarbear.js

 

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites



option 1: set the header HttpSetUserAgent("MyUserAgent") based on that adobe website sends something else

option 2 http over tcp socket (not working, something about not receiving the response) probably rewrite with UDP* functions

Example()
;~ https://get.adobe.com/flashplayer/?loc=nl
Func Example()
    $Host="get.adobe.com"
    Opt("TCPTimeout", 1000) ;1000 milliseconds

    TCPStartup() ; Start the TCP service.

    ; Register OnAutoItExit to be called when the script is closed.
    OnAutoItExitRegister("OnAutoItExit")

    ; Assign Local variables the internet Address and the Port.
;~  "https://" &
    Local $sIPAddress = TCPNameToIP( $Host)
    Local $iPort = 443 ; 80 ; Port used for the connection. HTTPS=443 normally

    ; Assign a Local variable the socket and connect to a Listening socket with the IP Address and Port specified.
    Local $iSocket = TCPConnect($sIPAddress, $iPort)
    consolewrite("Connect to " & $sIPAddress & " on port 443 ... " & @error & @CRLF)

    TCPSend($iSocket, "GET /flashplayer HTTP/1.1" & @CRLF)

    TCPSend($iSocket, "Host: " & $Host & @CRLF)
    TCPSend($iSocket, "Connection: close" & @CRLF)
;~      TCPSend($iSocket, "Connection: Keep-Alive" & @CRLF)
;~  TCPSend($iSocket, "User-Agent: AutoIT RAW HTTP" & @CRLF)
    TCPSend($iSocket, "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" & @CRLF)
    TCPSend($iSocket, "Cache-Control: no-cache" & @CRLF)
    TCPSend($iSocket, @CRLF)         ;        # end of request.

    $data=TCPRecv($iSocket, 4096 )
;~  $data=TCPRecv($iSocket, 16 )
    consolewrite("Data:" & @error & $data & @CRLF)

    $allData=""
    while (@Error=0)
;~      TCPSend($iSocket, @CRLF)         ;        # end of request.

        $allData=$allData&$data
        $data=TCPRecv($iSocket, 2048,1 )
    WEnd
    $allData=$allData&$data

    consolewrite($allData)
EndFunc   ;==>Example

Func OnAutoItExit()
    TCPShutdown() ; Close the

 

Share this post


Link to post
Share on other sites

YOU ARE THEEEEEE MANNNNNN!!!!

:ninja::party::rambo::sorcerer::king:
|
:guitar::cheer::thumbsup:

HttpSetUserAgent("Mozilla/5.0 (compatible; MSIE 11.0; Windows NT 6.1; WOW64; Trident/7.0) like Gecko")

 


"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
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

  • Similar Content

    • Tippex
      By Tippex
      I have a problem trying to use _IEAttach to recover control after a Windows Explorer reset (e.g. on Windows 7), since all the 
      InternetExplorer.Application objects appear to be destroyed by this event. An example of this is when a PC has some kind of fault causing a pop-up error message "Windows Explorer has stopped working". I can simulate this event by using Windows Task Manager to end the Explorer.exe process then to file, new task (run...) Explorer.exe
      After this event, _IEAttach gives an @error of: 
      7 ($_IEStatus_NoMatch) - No Match
      However, using WinList() followed by WinGetText() I can recover the URL for an IE session that has lost its 
      InternetExplorer.Application object which could be used to _IECreate a new session (the $iTryAttach fails) and WinKill() the original session but the result is a if a refresh had been done (any form entries are lost) . Unfortunately form entries do not appear as text or hidden text to Windows so I'm looking for the best way to read the contents of an Internet Explorer screen (even if just text without structure). 
      When there is no InternetExplorer.Application object (because of some Windows fault) but still with an Internet Explorer session running, I tried to read its contents by a "Select All" & "Copy to Clipboard" but its form entries are blanked and combo boxes choices are all displayed with no way of finding out which ones were selected.
      Local $ClipBoardSave = _ClipBoard_GetData() ;not ClipGet() which is text only ClipPut("") ;Clear User's Clipboard Local $sText = "" Local $hWnd = WinActivate("Window Title", "") If IsHWnd($hWnd) Then Local $bStatusCtrlSend = ControlSend("Window Title", "", "", "^a^c") If $bStatusCtrlSend Then Local $bStatusCtrlClick = ControlClick("Window Title", "", "") If $bStatusCtrlClick Then $sText = ClipGet() _ClipBoard_SetData($ClipBoardSave) ;not ClipPut($ClipBoardSave) which is text only  
      Is  there a solution to this please?
    • AnonymousX
      By AnonymousX
      Hello,
      I need to pull data from company intranet website. I created a script that I can give a list of project numbers and it will open up the the related webpage for each project, save the html comments for that project, then move on to the next. 
      However my problem comes in that each time I open up a project it locks it for other users, and if you just exit the page it keeps it locked, you have to actually press the "close" button on the page. So I'm not sure how to deal with this as I end up just locking every project in my name when I run my program as I don't understand the nature of how the website is built. I don't understand how to close with just using my automation code without manually having to press the stupid button. 
      My Function:
      Func Getscript($ProjectAddress) ;getting the page source code and storing it into text file for easy reading it $file = FileOpen(@ScriptDir & "\source.txt", 10) $IE = _IECreate($ProjectAddress & ".html", 0, 0) $source = _IEDocReadHTML($IE) FileWrite($file, $source) $target_source = _StringBetween($source, "<BODY>", "</BODY>") ; only take content between the specified tags _IEQuit($IE) FileClose($file) return $target_source[0] EndFunc ;==>Getscript  
      Source Code I got from website that I think is relevant:
      function closeForm(){ if(topButtonEnabled("closeButton")){ parent.mainFrame.closeForm(); } } <button id="closeButton" class="saveCloseButton" style="LEFT: 77px;" onclick=closeForm()>&nbsp;Close&nbsp;</button>  
      Any Ideas of how to tell website to either activate the closeform function or just give it the command to close?
       
      Thanks
    • AndreyS
      By AndreyS
      Tell me, please, who knows why the function does not work with the specified site? _INetGetSource ("https://residence.biz.ua/")
      It is necessary to work with the protocol https. What is the problem?
    • Tippex
      By Tippex
      I'm having a problem with _IEBodyReadText() which is a function from the IE.au3 UDF include.
      My problem is that randomly it will crash my script with:
      Return SetError($_IESTATUS_Success, 0, $oObject.document.body.innerText) Return SetError($_IESTATUS_Success, 0, $oObject.document.body^ ERROR I don't know why the error isn't caught by __IEErrorHandlerRegister but looking at this function, I can see that there is a check done by IsObj($oObject) to ensure that the object "$oObject" exists but no check that it contains the property "innerText"
      ; #FUNCTION# ==================================================================================================================== ; Author ........: Dale Hohm ; =============================================================================================================================== Func _IEBodyReadText(ByRef $oObject) If Not IsObj($oObject) Then __IEConsoleWriteError("Error", "_IEBodyReadText", "$_IESTATUS_InvalidDataType") Return SetError($_IESTATUS_InvalidDataType, 1, 0) EndIf If Not __IEIsObjType($oObject, "browserdom") Then __IEConsoleWriteError("Error", "_IEBodyReadText", "$_IESTATUS_InvalidObjectType", "Expected document element") Return SetError($_IESTATUS_InvalidObjectType, 1, 0) EndIf ; Return SetError($_IESTATUS_Success, 0, $oObject.document.body.innerText) EndFunc ;==>_IEBodyReadText I'm struggling to find out how to test if "$oObject.document.body.innerText" exists before allowing the following Return statement to reference it with the assumption that it does exist (crashing my script when it doesn't).
      Any ideas please?
    • Ubermensch
      By Ubermensch
      Hello guys,
      I am trying to create autoit codes in order to determine if IE button was clicked or pressed.
      I am not sure if it is possible for IE button.
      Here is my initial code.
      #include <IE.au3> #include <MsgBoxConstantsau #include <WinAPI.au3> AutoIt $searchTab = "Untitled 1 - Internet Explorer" WinActivate("Untitled 1 - Internet Explorer") Local $oIE = _IEAttach("", "instance", 1) For $i = 0 To 100 Send("^" & $i) Sleep(250) If Not(StringInStr(WinGetTitle("[ACTIVATE]", $searchTab) = 0) Then While 1 If $oGetItem = 1 Then MsgBox($MB_SYSTEMMODAL, "Attention!", "It's working!") EndIf WEnd ExitLoop EndIf Next