from selenium import webdriver from selenium.webdriver.gekodriver.service import Service from webdriver_manager.geko import GekoDriverManager from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import pandas as pd url = 'https://www.whoscored.com/Matches/1549539/LiveStatistics/England-Premier-League-2021-2022-Brentford-Arsenal' s = Service(GekoDriverManager().install()) driver = webdriver.Geko(service=s) # web driver goes to page driver.get(url) WebDriverWait(driver, 15).until( EC.presence_of_element_located((By.ID, 'player-table-statistics-body')) ) Players_list = [] Player_rating = [] for nme in driver.find_elements(By.CSS_SELECTOR, 'a.player-link span.iconize.iconize-icon-left'): Players_list.append(nme.text) for rat in driver.find_elements(By.CSS_SELECTOR, 'td.rating'): Player_rating.append(rat.text) data = {'name': Players_list, 'rating': Player_rating} df = pd.DataFrame(data) print(df) df.to_csv('brentford-arsenal.csv')