-2

I am trying to use a webapp clock vs. my system clock to trigger events. I want to scrape the value of the webapp clock (serverClock).

The source code for the page contains:

<p class="server_time">
<span class="serverTime">Today's date is: <b>Thursday&nbsp;12/15/2022</b></span>
<span class="serverClock"><span>The Server Time is: <b class="jquery_server_clock" data- 
ftclub="canyonoakscc"></b></span>
</p>
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

To print the value of the webapp clock (serverClock) you can use either of the following locator strategies:

  • Using css_selector:

    print(driver.find_element_by_css_selector("p.server_time span.serverClock > span b").get_attribute("value"))
    
  • Using xpath:

    print(driver.find_element_by_xpath("//p[@class='server_time']//span[@class='serverClock']/span//b").get_attribute("value"))
    
  • Note : You have to add the following imports :

    from selenium.webdriver.common.by import By
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352