display overhaul, compatibility with legacy plugins, fixes

This commit is contained in:
marios
2022-05-26 04:00:18 +03:00
parent 74438a3145
commit 4b923c1dc7
20 changed files with 2014 additions and 229 deletions
+16
View File
@@ -48,6 +48,10 @@ class Tab:
await self.client.close()
return res
async def get_steam_resource(self, url):
res = await self.evaluate_js(f'(async function test() {{ return await (await fetch("{url}")).text() }})()', True)
return res["result"]["result"]["value"]
def __repr__(self):
return self.title
@@ -93,3 +97,15 @@ async def tab_has_global_var(tab_name, var_name):
return False
return res["result"]["result"]["value"]
async def tab_has_element(tab_name, element_name):
try:
tab = await get_tab(tab_name)
except ValueError:
return False
res = await tab.evaluate_js(f"document.getElementById('{element_name}') != null", False)
if not "result" in res or not "result" in res["result"] or not "value" in res["result"]["result"]:
return False
return res["result"]["result"]["value"]