File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,19 @@ const agent = new BrowserAgent({
1717
1818( async ( ) => {
1919 const page = await agent . newPage ( ) ;
20- await page . goto ( "https://www.loblaws.ca/en/food/bakery/bread/c/28251" ) ;
20+
21+ await page . setViewportSize ( { width : 1280 , height : 1024 } ) ;
22+
23+ await page . route ( "**/*" , ( route , request ) => {
24+ const resourceType = request . resourceType ( ) ;
25+ if ( [ "image" , "video" , "media" , "font" ] . includes ( resourceType ) ) {
26+ route . abort ( ) ;
27+ } else {
28+ route . continue ( ) ;
29+ }
30+ } ) ;
31+
32+ await page . goto ( "https://news.ycombinator.com/" ) ;
2133 try {
2234 await page . waitForLoadState ( "networkidle" , { timeout : 10000 } ) ;
2335 } catch {
@@ -29,8 +41,9 @@ const agent = new BrowserAgent({
2941 console . log ( "Run extraction for page 1" ) ;
3042 let nextPageNumber = 2 ;
3143 let hasNextPage = true ;
44+ const maxPage = 3 ;
3245
33- while ( hasNextPage ) {
46+ while ( hasNextPage && nextPageNumber <= maxPage ) {
3447 const result = await page . ai (
3548 `Go to page ${ nextPageNumber } of the results. If page ${ nextPageNumber } does not exist, return early and complete the task.` ,
3649 {
Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ const DEFAULT_ACTIONS = [
4141 ScrollActionDefinition ,
4242 InputTextActionDefinition ,
4343 KeyPressActionDefinition ,
44- ThinkingActionDefinition ,
44+ // --- Disable for now - saw issues with invalid structured output because of this action
45+ // ThinkingActionDefinition,
4546] ;
4647
4748if ( process . env . GEMINI_API_KEY ) {
You can’t perform that action at this time.
0 commit comments