Код: Выделить всё
async def Clear_Page(self):
try:
await self.browser.contexts[0].pages[0].goto(check_site_url)
try:
await self.browser.contexts[0].clear_cookies()
await self.browser.contexts[0].pages[0].evaluate('localStorage.clear();')
await self.browser.contexts[0].pages[0].evaluate('sessionStorage.clear();')
except Exception as S:
print('s ' + str(S))
await self.browser.contexts[0].pages[0].reload()
return True
except Exception as A:
print(A)
return False
Подробнее здесь: https://stackoverflow.com/questions/787 ... playwright