Page 1 of 1

pwb get element help

Posted: 04 Dec 2017, 16:32
by HIAC
Any ideas how can I get the link of first song on the page?

Code: Select all

ypwb := ComObjCreate("InternetExplorer.Application")
ypwb.Visible := true
ypwb.Navigate("https://www.youtube.com/results?search_query=Song")
while ypwb.busy or ypwb.ReadyState !=4
	sleep, 10

URL := pwb.document.getElementsByClassName("yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2 yt-uix-sessionlink      spf-link ").item(0).href
MsgBox % URL

Re: pwb get element help  Topic is solved

Posted: 04 Dec 2017, 16:57
by Xtra
Try changing pwb to ypwb like the rest of your code.

Re: pwb get element help

Posted: 04 Dec 2017, 16:59
by A_AhkUser
Hi HIAC,

Here's a solution

Code: Select all

document.getElementById("contents").getElementsByTagName("a")[1].href

Re: pwb get element help

Posted: 04 Dec 2017, 17:00
by A_AhkUser
Xtra wrote:Try changing pwb to ypwb like the rest of your code.
I didn't noticed the typo... :facepalm:

Re: pwb get element help

Posted: 04 Dec 2017, 17:25
by HIAC
God damn!
Thank you both, solved.