我是新 to的,我的主要目标是废除我为我所玩的每一条游戏而获得的录像游戏。
driver = webdriver.Chrome()
url = "https://destinytracker.com/destiny-2/profile/psn/4611686018440125811/matches?mode=crucible"
driver.get(url)
wait = WebDriverWait(driver, 30)
ignored_exceptions=(NoSuchElementException,StaleElementReferenceException)
crucible_content = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.trn-gamereport-list.trn-gamereport-list--compact")))
game_reports = crucible_content.find_elements(By.CLASS_NAME, "trn-gamereport-list__group")
for game_report in game_reports:
group_entry = wait.until(EC.presence_of_element_located((By.CLASS_NAME, "trn-gamereport-list__group-entries")))
win_match = group_entry.find_elements(By.CLASS_NAME,"trn-match-row--outcome-win")
driver.execute_script("arguments[0].scrollIntoView();", win_match[0])
lose_match = group_entry.find_elements(By.CLASS_NAME, "trn-match-row--outcome-loss")
for win_element in win_match:
#try:
#sleep(10)
#driver.execute_script("arguments[0].scrollIntoView();", win_element)
win_left = wait.until(EC.presence_of_element_located((By.CLASS_NAME, "trn-match-row__section--left")))
driver.execute_script("arguments[0].click();", win_left)
print("reached here")
date_time = wait.until(EC.presence_of_element_located((By.XPATH, "//div[@class= info ]")))
date_time = date_time.text
date_time = date_time.split(",")
date_time = date_time[0]
match_roster = wait.until(EC.presence_of_element_located((By.CLASS_NAME,"match-rosters")))
team_alpha = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "div.match-roster.alpha")))
team_bravo = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "div.match-roster.bravo")))
bravo_match_roster_entries = team_bravo.find_element(By.CLASS_NAME, "roster-entries")
alpha_match_roster_entries = team_alpha.find_element(By.CLASS_NAME,"roster-entries")
name = wait.until(EC.presence_of_element_located((By.CLASS_NAME, "router-link-active")))
entry_bravo = bravo_match_roster_entries.find_elements(By.CLASS_NAME,"entry")
entry_alpha = alpha_match_roster_entries.find_elements(By.CLASS_NAME,"entry")
print(date_time)
I want to loop over each win I have and collect the stats from that game(along with the time.) I get this result:
reached here
7/12/2023
reached here
Traceback (most recent call last):
File "/Users/victoruduma/Documents/python web scraping part 2 .py", line 121, in <module>
crucible_dataset()
File "/Users/victoruduma/Documents/python web scraping part 2 .py", line 55, in crucible_dataset
date_time = wait.until(EC.presence_of_element_located((By.XPATH, "//div[@class= info ]")))
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/support/wait.py", line 95, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
问题一是,即使我发现这一错误,它仍然照旧。 在过去的一周里,我一直 st着这个问题,甚至在基督教女权运动会的帮助下。 任何帮助都会得到真正赞赏。