Struggling to extract JavaScript content from a website with selenium and geckodriver, but coming up empty-handed. Below is the snippet of JavaScript code:
<div _ngcontent-c2="" class="header-wrapper">
<div _ngcontent-c2="" class="title">Suda Office</div>
<div _ngcontent-c2="" class="update">Jul 05 11:07 AM</div>
</div>
<div _ngcontent-c2="">
<div _ngcontent-c2="" class="item-row title-headers">
<div _ngcontent-c2="" class="item-col head1">Route</div>
<div _ngcontent-c2="" class="item-col head2">Destination</div>
<div _ngcontent-c2="" class="item-col">
<div _ngcontent-c2="" class="head3 head3-height">ETA</div>
</div>
</div>
<div _ngcontent-c2="">
<div _ngcontent-c2="" class="alternet-color">
<div _ngcontent-c2="" class="item-row item-eta-row">
<div _ngcontent-c2="" class="item-col eta-route">15 T</div>
<div _ngcontent-c2="" class="item-col eta-destination">
<marquee _ngcontent-c2=""> Charbagh</marquee></div>
<div _ngcontent-c2="" class="item-col eta-col">
<div _ngcontent-c2="" class="eta-display-wrapper">
<div _ngcontent-c2="" class="display">
<span _ngcontent-c2="" class="space"></span>
<span _ngcontent-c2="" class="currentTiming">10 min</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Need to retrieve data from class="item-col eta-route"
, class="item-col eta-destination"
, and class="currentTiming"
in the JavaScript above. Tried using the following code without success:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get(url)
a = driver.find_elements_by_class_name("item-col eta-route")
However, a=[]
as output. Even attempting
d = driver.find_elements_by_class_name("currentTiming")
results in:
[<selenium.webdriver.firefox.webelement.FirefoxWebElement (session="6b1f2344-8e8a-4f48-a29a-54610179d62f", element="38e7ce58-ea66-4461-bee7-f81ac414595b")>]
Seeking advice on how to properly extract information from the page using selenium.