Fix multiple apps 5990457f-2adb-467b-a4af-5c857c92d762
This commit is contained in:
@@ -82,34 +82,28 @@ def get_info_from_website(env, config: Dict[Any, Any]) -> Any:
|
|||||||
page.wait_for_load_state('load')
|
page.wait_for_load_state('load')
|
||||||
action = info_dict.get('action', 'inner_text')
|
action = info_dict.get('action', 'inner_text')
|
||||||
if action == "inner_text":
|
if action == "inner_text":
|
||||||
ele = page.locator(info_dict['selector'])
|
ele = page.wait_for_selector(info_dict['selector'], state='attached', timeout=10000)
|
||||||
expect(ele).to_be_visible()
|
|
||||||
infos.append(ele.inner_text())
|
infos.append(ele.inner_text())
|
||||||
elif action == "attribute":
|
elif action == "attribute":
|
||||||
ele = page.locator(info_dict['selector'])
|
ele = page.wait_for_selector(info_dict['selector'], state='attached', timeout=10000)
|
||||||
expect(ele).to_be_visible()
|
|
||||||
infos.append(ele.get_attribute(info_dict['attribute']))
|
infos.append(ele.get_attribute(info_dict['attribute']))
|
||||||
elif action == 'click_and_inner_text':
|
elif action == 'click_and_inner_text':
|
||||||
for idx, sel in enumerate(info_dict['selector']):
|
for idx, sel in enumerate(info_dict['selector']):
|
||||||
if idx != len(info_dict['selector']) - 1:
|
if idx != len(info_dict['selector']) - 1:
|
||||||
link = page.locator(sel)
|
link = page.wait_for_selector(sel, state='attached', timeout=10000)
|
||||||
expect(link).to_be_visible()
|
|
||||||
link.click()
|
link.click()
|
||||||
page.wait_for_load_state('load')
|
page.wait_for_load_state('load')
|
||||||
else:
|
else:
|
||||||
ele = page.locator(sel)
|
ele = page.wait_for_selector(sel, state='attached', timeout=10000)
|
||||||
expect(ele).to_be_visible()
|
|
||||||
infos.append(ele.inner_text())
|
infos.append(ele.inner_text())
|
||||||
elif action == 'click_and_attribute':
|
elif action == 'click_and_attribute':
|
||||||
for idx, sel in enumerate(info_dict['selector']):
|
for idx, sel in enumerate(info_dict['selector']):
|
||||||
if idx != len(info_dict['selector']) - 1:
|
if idx != len(info_dict['selector']) - 1:
|
||||||
link = page.locator(sel)
|
link = page.wait_for_selector(sel, state='attached', timeout=10000)
|
||||||
expect(link).to_be_visible()
|
|
||||||
link.click()
|
link.click()
|
||||||
page.wait_for_load_state('load')
|
page.wait_for_load_state('load')
|
||||||
else:
|
else:
|
||||||
ele = page.locator(sel)
|
ele = page.wait_for_selector(sel, state='attached')
|
||||||
expect(ele).to_be_visible()
|
|
||||||
infos.append(ele.get_attribute(info_dict['attribute']))
|
infos.append(ele.get_attribute(info_dict['attribute']))
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(f'The action {action} is not supported yet.')
|
raise NotImplementedError(f'The action {action} is not supported yet.')
|
||||||
|
|||||||
@@ -95,19 +95,12 @@ def get_vm_file(env, config: Dict[str, Any]) -> Union[Optional[str], List[Option
|
|||||||
paths = [p.split(".")[0] + datetime.now().strftime(time_format) + "." + p.split(".")[1] if "." in p else p for p in paths]
|
paths = [p.split(".")[0] + datetime.now().strftime(time_format) + "." + p.split(".")[1] if "." in p else p for p in paths]
|
||||||
dests = [d.split(".")[0] + datetime.now().strftime(time_format) + "." + d.split(".")[1] if "." in d else d for d in dests]
|
dests = [d.split(".")[0] + datetime.now().strftime(time_format) + "." + d.split(".")[1] if "." in d else d for d in dests]
|
||||||
|
|
||||||
print(paths)
|
|
||||||
print(dests)
|
|
||||||
|
|
||||||
cache_paths: List[str] = []
|
cache_paths: List[str] = []
|
||||||
|
|
||||||
gives: Set[int] = set(config.get("gives", [0]))
|
gives: Set[int] = set(config.get("gives", [0]))
|
||||||
|
|
||||||
for i, (p, d) in enumerate(zip(paths, dests)):
|
for i, (p, d) in enumerate(zip(paths, dests)):
|
||||||
print("env cache_dir: ")
|
|
||||||
print(env.cache_dir)
|
|
||||||
_path = os.path.join(env.cache_dir, d)
|
_path = os.path.join(env.cache_dir, d)
|
||||||
print("_path: ")
|
|
||||||
print(_path)
|
|
||||||
file = env.controller.get_file(p)
|
file = env.controller.get_file(p)
|
||||||
if file is None:
|
if file is None:
|
||||||
#return None
|
#return None
|
||||||
@@ -121,8 +114,6 @@ def get_vm_file(env, config: Dict[str, Any]) -> Union[Optional[str], List[Option
|
|||||||
with open(_path, "wb") as f:
|
with open(_path, "wb") as f:
|
||||||
f.write(file)
|
f.write(file)
|
||||||
# debug
|
# debug
|
||||||
print("cache_paths")
|
|
||||||
print(cache_paths)
|
|
||||||
return cache_paths[0] if len(cache_paths)==1 else cache_paths
|
return cache_paths[0] if len(cache_paths)==1 else cache_paths
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,15 +23,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "chrome_open_tabs",
|
|
||||||
"parameters": {
|
|
||||||
"urls_to_open": [
|
|
||||||
"https://arxiv.org/abs/2005.14165",
|
|
||||||
"https://wallhaven.cc/"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "download",
|
"type": "download",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
@@ -105,7 +96,7 @@
|
|||||||
"147",
|
"147",
|
||||||
"372",
|
"372",
|
||||||
"Deep learning",
|
"Deep learning",
|
||||||
"https://creativecoding.soe.ucsc.edu/courses/cs523/slides/week3/DeepLearning_LeCun.pdf"
|
"https://hal.science/hal-04206682/document"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
|
|||||||
Reference in New Issue
Block a user