Jump to content

Can't catch a dinamic result in a page


 Share

Recommended Posts

Hi everione!

To get the information that i want i have to fill a text box and then click the button. Apparently there's no problem, but the point is that the answer is showed dinamically on the page in a "div" that, before clicking the button was hide, and when i try to get the part of the page that i want with a _StringBetween function it doesn't works because doesn't find the new part of the HTML code that appears after the request.

The is the code that i'm trying to use. I tried to use the function _IELoadWait, but it seems there's no efect...

;Includes
;================================================
#include <IE.au3>
#Include <String.au3>
;================================================
;Variables
;================================================

$URL="http://www.fib.upc.edu/fib/"
$tool="http://whatlanguageisthis.com/" ; tool to use

;================================================
;Inicio Script
;================================================


$WinHttpReq = ObjCreate("winhttp.winhttprequest.5.1")   ;Realizamos la peticion HTTP
$WinHttpReq.open("GET",$URL)
$WinHttpReq.send()
$HTML = $WinHttpReq.ResponseText                        ;Recuperamos el HTML de la web

$titulo = _StringBetween($HTML,"<title","</title>")
$header = _StringBetween($HTML,"<h1","</h1>")
ConsoleWrite("el texto sera este: " & $titulo[0] & " " & $header[0] & @CRLF)

$IE = _IECreate($tool)
_IELoadWait($IE)

$input = _IEGetObjById($IE,"input")
_IEDocInsertText($input,$titulo[0]& " " & $header[0])
$boton = _IEGetObjById($IE,"analyze")
_IEAction($boton,"click")
_IELoadWait($IE,6000,6000) ; 

$result = _IEGetObjById($IE,"result")
$language_s = _StringBetween($result,"<span id=language>","</span>")

The page that i'm trying to deal with is "http://whatlanguageisthis.com/", that if you put some text in the text box and click in the button tells you what language the text belongs to. How can i get the name of the language that apears after processing the request??

It happens the same in other page i'm trying to get info, so i guess that the main question is how i can get info of a part of a HTML code that apears after a request is processed? because it seems that with comands like _IEDocReadHTML or _IEBodyReadHTML doesn't works.

I would appreciate a lot your help!!!

Thanks a lot in advance!!!!!

Edgariyu

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...