I've got most of a scraping code figured out - I'm trying to get the 1st and 2nd halfs from a link like this: Lafayette Leopards vs. Villanova Wildcats - Box Score - November 11, 2016 | FOX Sports.
The link initially defaults to the box score - but I'm able to code in clicking on the 'play-by-play' to bring up the html code I need. Where I'm having a problem is getting to the 2nd half - I can't figure out how to encode clicking on the '2' in the link. It almost looks to be not a problem of clicking, but of changing the class of one of the elements. Please let me know if you can help - I'm a little bit stuck here.
Here are the relevant bits of code - omitted the scraping part, because it's not the piece I'm having trouble with.
Appreciate any help I can get - thanks.
The link initially defaults to the box score - but I'm able to code in clicking on the 'play-by-play' to bring up the html code I need. Where I'm having a problem is getting to the 2nd half - I can't figure out how to encode clicking on the '2' in the link. It almost looks to be not a problem of clicking, but of changing the class of one of the elements. Please let me know if you can help - I'm a little bit stuck here.
Here are the relevant bits of code - omitted the scraping part, because it's not the piece I'm having trouble with.
Code:
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
site = Range("h1").Value
With IE
.Visible = True
.navigate site
.Top = 50
.Left = 530
.Height = 400
.Width = 400
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
End With
ID = "wisbb_bsCPbpSmallTable"
Set htmldoc = IE.document 'Document webpage
htmldoc.getElementsByClassName("wisbb_shortName").Item(2).Click 'Gets me to play-by-play'
htmldoc.getElementsByClassName("wisfb_bsPbpSelected").Item(1).Click 'No variation of this (changing the item, the class name, etc.) has gotten me to the second half
Appreciate any help I can get - thanks.