Python Selenium Get Content Of Table
I am trying to scrape a website using python selenium bindings. I want to get the content of a table using selenium. I am quite new to python and selenium so please excuse my ignor
Solution 1:
Try below code to get required values:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://www.designmynight.com/london/bars/soho/six-storeys')
hours = driver.find_element_by_xpath('//li[@id="hours"]')
hours.click()
hoursTable = driver.find_elements_by_css_selector("table.opening-times tr")
for row in hoursTable:
print(row.text)
Note that class
name of table
is not "opening-hours"
, but "opening-times"
Output:
'Day Open Close Notes''Monday 08:00 00:00''Tuesday 08:00 00:00''Wednesday 08:00 00:00''Thursday 08:00 01:00''Friday (today) 08:00 02:00''Saturday 10:00 02:00''Sunday 10:00 00:00'
Post a Comment for "Python Selenium Get Content Of Table"