1

HockeyReference.com has a table on each player's page called NHL Possession Metrics, and that table has selectable tabs for "All", "Even Strength", "Power Play" and other situations. The "All" table is the displayed table, but I want to scrape information from the hidden "Power Play Table." I can't seem to find a way to get any data from the hidden sub-table "Power Play" though. Here is the link to a sample player's page: https://www.hockey-reference.com/players/a/abdelju01.html

What I'm trying to do is search by XPath to find the season entry for each row in the Power Play table, and then find the TOI column entry in the row, and cycle each row until there are no more season entries. I'm not getting any values though, and sval and tval in my code keep returning empty. Any help would be greatly appreciated.

The Code I've tried is:

Dim chrm As Selenium.ChromeDriver

Dim Hitem As Selenium.WebElement, Citem As Selenium.WebElement

Dim xpval As String, sval As String, tval As String

Dim rnum As Integer

rnum = 1

Do

    xpval = "/html/body/div[4]/div[5]/div[9]/div[9]/div[3]/table/tbody/tr[" & Trim(Str(rnum)) & "]/th"

    Set Hitem = chrm.FindElementByXPath(xpval, timeout:=0)

    sval = Hitem.Text

    xpval = "/html/body/div[4]/div[5]/div[9]/div[9]/div[3]/table/tbody/tr[" & Trim(Str(rnum)) & "]/td[5]"

    Set Citem = chrm.FindElementByXPath(xpval, timeout:=0)

    tval = Citem.Text

    If tval <> "" Then

        ...

    End If

    rnum = rnum + 1

Loop Until IsNumeric(Left(sval, 4)) = False
1
  • It's not that the data is "hidden" per se, but rather within the comments of the source html. You'll need to remove the comment tags, or extract the comments in some way, from the html to parse the table. Commented Aug 7 at 6:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.