File tree Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Original file line number Diff line number Diff line change 145145 }
146146}
147147
148- result , execution_info = graph .execute ({
149- "user_prompt" : "How many list items are there in the document?" ,
150- "local_dir" : str (subtree_dict_simple )
151- })
152-
153- # get the answer from the result
154- result = result .get ("answer" , "No answer found." )
155- print (result )
148+ from playwright .sync_api import sync_playwright , Playwright
149+
150+ def run (playwright : Playwright ):
151+ chromium = playwright .chromium # or "firefox" or "webkit".
152+ browser = chromium .launch ()
153+ page = browser .new_page ()
154+ page .goto ("https://www.wired.com/category/science/" )
155+ #get accessibilty tree
156+ accessibility_tree = page .accessibility .snapshot ()
157+
158+ result , execution_info = graph .execute ({
159+ "user_prompt" : "List me all the latest news with their description." ,
160+ "local_dir" : str (accessibility_tree )
161+ })
162+
163+ # get the answer from the result
164+ result = result .get ("answer" , "No answer found." )
165+ print (result )
166+ # other actions...
167+ browser .close ()
168+
169+ with sync_playwright () as playwright :
170+ run (playwright )
171+
You can’t perform that action at this time.
0 commit comments