'How to solve this issue scraping flashscore?
I'm facing this issue trying to scrape flashscore.co.uk.
games1 = driver.find_elements(By.CSS_SELECTOR, 'div[class = "event__match event__match--live event__match--last event__match--twoLine"]')
data1 = []
for game1 in games1:
data1.append({
'Home': game1.find_element(By.CSS_SELECTOR, 'div[class = "event__participant event__participant--home"]').text,
'Away': game1.find_element(By.CSS_SELECTOR, 'div[class = "event__participant event__participant--away"]').text,
'Time': game1.find_element(By.CSS_SELECTOR, 'div[class = "event__stage--block"]').text
})
df1 = pd.DataFrame(data1) # create dataframe
But when it goes through Home team and away for all matches it gives me this error
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"div[class = "event__participant event__participant--home"]"}
(Session info: chrome=100.0.4896.127)
How to solve this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
