Hey here is my async js function that i want to execute and return the value .
async function matcheslol() {
let allmatches=[]
let matches = document.getElementsByClassName('EventCellstyles__Link-sc-1m83enb-0 dhKVQJ')
for (i = 0; i < matches.length; i++) {
let details = (matches[i].innerText).split('\n').slice(2, 4);
let matchname = details.join(' - ');
console.log(matchname)
matches[i].firstChild.click()
await sleep(3000)
let votes = document.getElementsByClassName('styles__VotingWrapper-sc-1f9zoyc-1 iOsjnp')[0].innerText.split('\n').slice(0,3)
let date = document.getElementsByClassName('styles__Wrapper-sc-1c9nn5b-0 HoJZc ps ps--active-y')[1].getElementsByClassName('Content-sc-1o55eay-0 gYsVZh')[0].innerText
let dict={'DATE':date,'MatchTitle':matchname,'Votes':votes}
allmatches.push(dict)
}
return allmatches
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
matcheslol()
Python :
data=driver.execute_async_script(script_mentioned_above)
I get this error:
selenium.common.exceptions.TimeoutException: Message: script timeout