Page 1 of 1

This length of this class is not being returned

Posted: 29 Jun 2020, 05:16
by AHKStudent
I checked manually by visit the page and know there are 2 objects for this class. Nothing works related to using JS to get data from the response text (unless I use regex obviously), does anyone see where things are breaking?

Code: Select all

url :="https://chrome.google.com/webstore/detail/ferrari-wallpaper-hd-cust/facihnceaoboeoembnbmdlecmkpioacc?hl=en"
HTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1")
HTTP.Open("GET", url, true)
HTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko")
HTTP.Send()
HTTP.WaitForResponse()
respo := http.ResponseText
;msgbox, % respo
html := ComObjCreate("HTMLfile")
html.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=9"">")
html.designMode := "on"
html.write(respo)
msgbox, % html.getElementsByClassName("C-b-p-rc-D-R").length ;;[0].innerText

ExitApp

Re: This length of this class is not being returned

Posted: 29 Jun 2020, 22:23
by AHKStudent
if anyone has any ideas please post. :thumbup:

Re: This length of this class is not being returned

Posted: 30 Jun 2020, 06:30
by teadrinker
Some elements are loaded after loading the page by a javascript.

Re: This length of this class is not being returned

Posted: 30 Jun 2020, 06:43
by AHKStudent
teadrinker wrote:
30 Jun 2020, 06:30
Some elements are loaded after loading the page by a javascript.
But even if I save the entire page to a text file and I open the file manually and I see the class is there and then try to use AHK to get the info, it shows nothing. Is the problem maybe because there is a iframe there? I also did a regex test and the data is there.

Thanks for trying to help

Re: This length of this class is not being returned  Topic is solved

Posted: 30 Jun 2020, 06:54
by malcev

Code: Select all

respo := StrReplace(http.ResponseText, "<noscript>")

Re: This length of this class is not being returned

Posted: 30 Jun 2020, 09:00
by AHKStudent
malcev wrote:
30 Jun 2020, 06:54

Code: Select all

respo := StrReplace(http.ResponseText, "<noscript>")
:thumbup: :thumbup: :thumbup: Works like a charm thanks