on the following url there are 3 score cards.
https://www.basketball-reference.com/boxscores/?month=4&day=8&year=2023
I’ve tried many different variation of the xpaths to try and access the second one but the first one linking to the box score keeps being returned.
score_card = WebDriverWait(driver, 2).until(EC.presence_of_element_located((By.XPATH, "(//div[@class='game_summary expanded nohover '])[2]/p/a"))).click()
I’ve tried many different ways of changing it and can’t crack it! please help.
thank you
!
>Solution :
You don’t need to use brackets in your xpath.
Use .//div[@class='game_summary expanded nohover '][2]/p/a
and it should work.
Check the attached image