Created
May 28, 2020 01:43
-
-
Save teddiur/775d07b2d3b81b33d039f8101add7e7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search_matches(): | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".hm-MainHeaderLogoWide_Bet365LogoImage"))).click() | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CLASS_NAME, "wn-PreMatchItem "))) | |
sports = driver.find_elements_by_class_name("wn-PreMatchItem ") | |
find_item('futebol', sports).click() #go to soccer page | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CLASS_NAME, "hm-HeaderMenuItem "))) | |
live = driver.find_elements_by_class_name("hm-MainHeaderCentreWide_Link") | |
find_item('ao-vivo', live).click() #go to live games | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CLASS_NAME, "ovm-Competition"))) | |
all_leagues = driver.find_elements_by_class_name("ovm-Competition") | |
print(all_leagues) | |
leagues = find_items(all_leagues) | |
matches = [] | |
print(leagues) | |
for league in leagues: | |
league_matches = league.find_elements(By.CLASS_NAME,"ovm-FixtureDetailsTwoWay_TeamsAndScoresInner ") | |
if len(league_matches) > 1: | |
for match in league_matches: | |
matches.append(match) | |
else: | |
matches.append(league_matches[0]) | |
return matches |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment