diff --git a/desktop_env/evaluators/getters/chrome.py b/desktop_env/evaluators/getters/chrome.py index 0304827..13a5385 100644 --- a/desktop_env/evaluators/getters/chrome.py +++ b/desktop_env/evaluators/getters/chrome.py @@ -82,34 +82,28 @@ def get_info_from_website(env, config: Dict[Any, Any]) -> Any: page.wait_for_load_state('load') action = info_dict.get('action', 'inner_text') if action == "inner_text": - ele = page.locator(info_dict['selector']) - expect(ele).to_be_visible() + ele = page.wait_for_selector(info_dict['selector'], state='attached', timeout=10000) infos.append(ele.inner_text()) elif action == "attribute": - ele = page.locator(info_dict['selector']) - expect(ele).to_be_visible() + ele = page.wait_for_selector(info_dict['selector'], state='attached', timeout=10000) infos.append(ele.get_attribute(info_dict['attribute'])) elif action == 'click_and_inner_text': for idx, sel in enumerate(info_dict['selector']): if idx != len(info_dict['selector']) - 1: - link = page.locator(sel) - expect(link).to_be_visible() + link = page.wait_for_selector(sel, state='attached', timeout=10000) link.click() page.wait_for_load_state('load') else: - ele = page.locator(sel) - expect(ele).to_be_visible() + ele = page.wait_for_selector(sel, state='attached', timeout=10000) infos.append(ele.inner_text()) elif action == 'click_and_attribute': for idx, sel in enumerate(info_dict['selector']): if idx != len(info_dict['selector']) - 1: - link = page.locator(sel) - expect(link).to_be_visible() + link = page.wait_for_selector(sel, state='attached', timeout=10000) link.click() page.wait_for_load_state('load') else: - ele = page.locator(sel) - expect(ele).to_be_visible() + ele = page.wait_for_selector(sel, state='attached') infos.append(ele.get_attribute(info_dict['attribute'])) else: raise NotImplementedError(f'The action {action} is not supported yet.') diff --git a/desktop_env/evaluators/getters/file.py b/desktop_env/evaluators/getters/file.py index 4b5428a..d6e2087 100644 --- a/desktop_env/evaluators/getters/file.py +++ b/desktop_env/evaluators/getters/file.py @@ -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] 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] = [] gives: Set[int] = set(config.get("gives", [0])) 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) - print("_path: ") - print(_path) file = env.controller.get_file(p) if file is 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: f.write(file) # debug - print("cache_paths") - print(cache_paths) return cache_paths[0] if len(cache_paths)==1 else cache_paths diff --git a/evaluation_examples/examples/multi_apps/5990457f-2adb-467b-a4af-5c857c92d762.json b/evaluation_examples/examples/multi_apps/5990457f-2adb-467b-a4af-5c857c92d762.json index 9d754dd..eb77ab5 100644 --- a/evaluation_examples/examples/multi_apps/5990457f-2adb-467b-a4af-5c857c92d762.json +++ b/evaluation_examples/examples/multi_apps/5990457f-2adb-467b-a4af-5c857c92d762.json @@ -23,15 +23,6 @@ ] } }, - { - "type": "chrome_open_tabs", - "parameters": { - "urls_to_open": [ - "https://arxiv.org/abs/2005.14165", - "https://wallhaven.cc/" - ] - } - }, { "type": "download", "parameters": { @@ -105,7 +96,7 @@ "147", "372", "Deep learning", - "https://creativecoding.soe.ucsc.edu/courses/cs523/slides/week3/DeepLearning_LeCun.pdf" + "https://hal.science/hal-04206682/document" ] }, "options": {