stat = browser.find_element_by_css_selector(“#my-stats-content > div.card.stats- module.is-chart-tabs > ul > li:nth-child(2) > a > span.value”)
stat_value = stat.text
print(“Total number of visitors so far today =”, stat_value)
I’ve uploaded a video to show the function in action, please note the output on the terminal:
Selenium allows for elements to be selected by various functions including:
This function uses a few different element method selections to get the task done, but you may be wondering how to find out where to get the details for these from. I’ve put a very brief video together to show how I accessed them via Safari’s Develop menu.