This is a follow up to my previous question, I am trying to mine betting odds from this site https://bettingexplorer.com, I have installed Selenium package into my Python environment and downloaded the Chromium web driver and pointed the path to its executable in my script, I am trying to download the page from the site and then look for certain elements and add to an array and then build a Pandas Data Frame but the code is launching the chrome web driver and does nothing
import pandas as pd
import requests
from bs4 import BeautifulSoup
from selenium.webdriver.chrome import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
# define the path to the executable
chrome_path = "C:\Users\HP\Downloads\Compressed\chrome-win64\chrome-win64\Chrome.exe"
# DEFINE THE URL to use for mining odds
URL = "https://www.betexplorer.com/"
# define options for the Chromium web driver
options = Options()
options.add_argument("--start-maximized")
# initialize the web driver service
service = Service(chrome_path)
# import a web driver from chrome
driver = webdriver.ChromiumDriver(service=service, options=options)
driver.get(URL)
html = driver.page_source
soup = BeautifulSoup(html, 'html-parser')
driver.quit()
# get the betting odds from the downloaded page
table = soup.find('table', attrs={'class':"table-main h-mb15 sortable"})
rows = table.find_all('tr')
data = []
for row in rows:
cols = row.find_next('td')
bet = [element.text for element in cols if element.text != '']
if len(bet) == 4:
data.append(bet)
bet_odds = pd.DataFrame(data, columns=['Bookmarker', '1','X','2'])
print(bet_odds)
How can I use this code to download the match name, home odd, away odd and match date from the referenced link?