How to print table values from specific web page

from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC

options = Options() options.add_argument(‘–ignore-certificate-errors’) options.add_argument(‘–start-maximized’) options.page_load_strategy = ‘eager’

driver = webdriver.Chrome(options=options)

wait = WebDriverWait(driver, 20)
driver.get(“SEBI | Buybacks”)

month = “Apr” year = “2021”

2 Likes

Hey @rhian-lewis. Try using the below modified code. I hope this will solve your issue

driver = webdriver.Chrome()
driver.get('https://www.sebi.gov.in/sebiweb/home/HomeAction.do?doListing=yes&sid=3&ssid=22&smid=18')
month = "Apr"
year = "2021"
for row in driver.find_elements_by_xpath("//table/tbody/tr/td[1]"):
    if month in row.text and year in row.text:
        x = row.find_element_by_xpath("./following-sibling::td")
        print(row.text, " ", x.text)
2 Likes