MCPcopy Create free account
hub / github.com/THUDM/AutoWebGLM / check_unexpected_logout

Function check_unexpected_logout

webarena/scripts/check_error_runs.py:112–142  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

110
111
112def check_unexpected_logout(args: argparse.Namespace) -> int:
113 target_strings = set(
114 [
115 "Creating an account has many benefits: check out faster",
116 "Welcome, please sign in",
117 "Username or email",
118 "Keep me logged in",
119 ]
120 )
121
122 error_examples = []
123 for render_file in glob.glob(f"{args.result_folder}/render_*.html"):
124 with open(render_file, "r") as f:
125 contents = f.read()
126 if any([s in contents for s in target_strings]):
127 task_id = int(
128 render_file.split("/")[-1].split(".")[0].split("_")[-1]
129 )
130 error_examples.append(task_id)
131 print(f"Number of unexpected logout: {len(error_examples)}")
132 print(error_examples)
133 num_errors = len(error_examples)
134 if (
135 args.delete_errors
136 or input("Do you want to delete these examples? (y/n)") == "y"
137 ):
138 for idx in error_examples:
139 if os.path.exists(f"{args.result_folder}/render_{idx}.html"):
140 os.remove(f"{args.result_folder}/render_{idx}.html")
141
142 return num_errors
143
144
145if __name__ == "__main__":

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected