Feb-03-2019, 07:33 PM
Your functions setup in is wrong,just drop functions for now,if you unsure how they work.
It's a really messy site to deal with,so not the easiest to start with if new to this.
To show a way to get values from first line,it can also easier to send
Turn of headless under testing.
It's a really messy site to deal with,so not the easiest to start with if new to this.
To show a way to get values from first line,it can also easier to send
browser.page_source
to BS for parsing.Turn of headless under testing.
from selenium import webdriver from bs4 import BeautifulSoup from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys import time #--| Setup chrome_options = Options() #chrome_options.add_argument("--headless") #chrome_options.add_argument('--disable-gpu') #chrome_options.add_argument('--log-level=3') browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe') #--| Parse or automation browser.get('https://www.oddsportal.com/soccer/england/premier-league/wolves-newcastle-utd-nNNqedbR#1X2;4') # Give source code to BeautifulSoup soup = BeautifulSoup(browser.page_source, 'lxml') time.sleep(3) table_first_line = soup.select('#odds-data-table > div > table > tbody > tr:nth-of-type(1)') print(table_first_line[0].text.strip()) browser.quit()Get all values but need some clean up(white-space).
Output:bet-at-home 2.052.404.8490.0%
Look at Web-scraping part-2.