from urllib.request import urlopen from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.support.ui import Select from urllib.error import HTTPError import time address = 'https://www.premierleague.com/fixtures' try: url = urlopen(address) except HTTPError as ex: print('Url address is not right.') print(ex) else: print('ok') bs = BeautifulSoup(url, 'html.parser') driver = webdriver.Firefox() driver.get(address) time.sleep(3) cookies_btn = driver.find_elements_by_xpath('/html/body/section/div/div')[0] cookies_btn.click() close_btn = driver.find_elements_by_xpath('//*[@id="advertClose"]')[0] close_btn.click() #select = text1 = driver.find_elements_by_class_name('matchList') #pagesource = driver.page_source #bs = BeautifulSoup(pagesource, 'html.parser') #print(bs.find_all(class = '')) #data = text1.split('\n') for txt in text1: print(txt.text) #print(text1) #driver.close() #bs1 = bs.find_all('div', {'class': 'fixture preMatch'}) #for text in bs1: #print (text)