I've tried all kinds of ele.findElementAs--- and cannot "find" a particular (multiply nested) element on a webpage - even though I can visually see the element (and values) when inspecting the webpage.
I've used VBA+Edge+Selenium before and can locate / "find" other elements on this page, but not the one (or similar ones) I need.
url: www.cmegroup.com item: the Price for the December Corn Futures ("ZCZ2")
JSpath: document.querySelector("#main-content > div > div.component.section.cme-homepage-background-gradient-2.pt-5.reverse > div > div:nth-child(8) > div:nth-child(1) > div.component.react.heat-map.loaded > div > div > div:nth-child(1) > div > a.heat-map-card.heat-map-color_1 > div.product-values > div.rate")
snapshot of webpage code above target:
Code from webpage
my code sample:
Sub FindDecCorn()
Dim Edgdriver As New EdgeDriver
Edgdriver.Start "edge"
Edgdriver.Get "https://cmegroup.com"
' *** this one works - finds "main-content" ***
Dim ch As Selenium.WebElement
Set ch = Edgdriver.FindElementById("main-content")
'Set ch = driver.FindElementByLinkText("www.cmegroup.com/etc.clientlibs/cmegroupaem/clientlibs/heat-map.cc2d1dd424fd10c5642e7137587e27a7.css")
Debug.Print ch.tagname, ch.Attribute("id")
' *** I've tried all kinds of .FindElement(s)ByXXXX --- all failed ***
' *** this one fails to find anything with 'product-code' although there are several ***
Dim myElements As Selenium.WebElements
Set myElements = Edgdriver.FindElementsByCss("div[class='product-code']")
For Each myElement In myElements
Debug.Print myElement.Attribute("innerHTML")
Next myElement
Edgdriver.Quit
End Sub