Im trying to scape multiple pages of a football website. All the links are are in the list teamLinks. An example of one of the links is: 'http://www.premierleague.com//clubs/1/Arsenal/squad?se=79'. I was just wondering if it was possible to make the requests function wait until the page is fully updated before it is implemented. If you click on the link it will display initially the 2018/2019 squad and then refresh to the 2017/2018 squad which is the one i want.
playerLink1 = []
playerLink2 = []
for i in range(len(teamLinks)):
# Request
squadPage = requests.get(teamlinks[i])
squadTree = html.fromstring(squadPage.content)
#Extract the player links.
playerLocation = squadTree.cssselect('.playerOverviewCard')
#For each player link within the team page.
for i in range(len(playerLocation)):
#Save the link, complete with domain.
playerLink1.append("http://www.premierleague.com/" +
playerLocation[i].attrib['href'] + '?se=79')
#For the second link, change the page from player overview to stats
playerLink2.append(playerLink1[i].replace("overview", "stats"))