File tree Expand file tree Collapse file tree 20 files changed +1020
-37
lines changed Expand file tree Collapse file tree 20 files changed +1020
-37
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @browserbasehq/stagehand " : patch
3
+ ---
4
+
5
+ add support for shadow DOMs (open & closed mode) when experimental: true
Original file line number Diff line number Diff line change 420
420
"categories" : [" agent" ]
421
421
},
422
422
{
423
- "name" : " iframe_scroll" ,
423
+ "name" : " osr_in_oopif" ,
424
+ "categories" : [" act" ]
425
+ },
426
+ {
427
+ "name" : " csr_in_oopif" ,
428
+ "categories" : [" act" ]
429
+ },
430
+ {
431
+ "name" : " csr_in_spif" ,
432
+ "categories" : [" act" ]
433
+ },
434
+ {
435
+ "name" : " csr_in_spif" ,
436
+ "categories" : [" act" ]
437
+ },
438
+ {
439
+ "name" : " spif_in_osr" ,
440
+ "categories" : [" act" ]
441
+ },
442
+ {
443
+ "name" : " oopif_in_osr" ,
444
+ "categories" : [" act" ]
445
+ },
446
+ {
447
+ "name" : " spif_in_csr" ,
448
+ "categories" : [" act" ]
449
+ },
450
+ {
451
+ "name" : " oopif_in_csr" ,
452
+ "categories" : [" act" ]
453
+ },
454
+ {
455
+ "name" : " osr_in_spif" ,
424
456
"categories" : [" act" ]
425
457
},
426
458
{
427
459
"name" : " namespace_xpath" ,
428
460
"categories" : [" act" ]
461
+ },
462
+ {
463
+ "name" : " iframe_scroll" ,
464
+ "categories" : [" act" ]
429
465
}
430
466
]
431
467
}
Original file line number Diff line number Diff line change
1
+ import { EvalFunction } from "@/types/evals" ;
2
+
3
+ export const csr_in_oopif : EvalFunction = async ( {
4
+ debugUrl,
5
+ sessionUrl,
6
+ stagehand,
7
+ logger,
8
+ } ) => {
9
+ // this eval is designed to test whether stagehand can successfully
10
+ // click inside an CSR (closed mode shadow) root that is inside an
11
+ // OOPIF (out of process iframe)
12
+
13
+ const page = stagehand . page ;
14
+ try {
15
+ await page . goto (
16
+ "https://browserbase.github.io/stagehand-eval-sites/sites/closed-shadow-root-in-oopif/" ,
17
+ ) ;
18
+ await page . act ( { action : "click the button" , iframes : true } ) ;
19
+
20
+ const extraction = await page . extract ( {
21
+ instruction : "extract the entire page text" ,
22
+ iframes : true ,
23
+ } ) ;
24
+
25
+ const pageText = extraction . extraction ;
26
+
27
+ if ( pageText . includes ( "button successfully clicked" ) ) {
28
+ return {
29
+ _success : true ,
30
+ message : `successfully clicked the button` ,
31
+ debugUrl,
32
+ sessionUrl,
33
+ logs : logger . getLogs ( ) ,
34
+ } ;
35
+ }
36
+ return {
37
+ _success : false ,
38
+ message : `unable to click on the button` ,
39
+ debugUrl,
40
+ sessionUrl,
41
+ logs : logger . getLogs ( ) ,
42
+ } ;
43
+ } catch ( error ) {
44
+ return {
45
+ _success : false ,
46
+ message : `error: ${ error . message } ` ,
47
+ debugUrl,
48
+ sessionUrl,
49
+ logs : logger . getLogs ( ) ,
50
+ } ;
51
+ } finally {
52
+ await stagehand . close ( ) ;
53
+ }
54
+ } ;
Original file line number Diff line number Diff line change
1
+ import { EvalFunction } from "@/types/evals" ;
2
+
3
+ export const csr_in_spif : EvalFunction = async ( {
4
+ debugUrl,
5
+ sessionUrl,
6
+ stagehand,
7
+ logger,
8
+ } ) => {
9
+ // this eval is designed to test whether stagehand can successfully
10
+ // click inside an CSR (closed mode shadow) root that is inside an
11
+ // SPIF (same process iframe)
12
+
13
+ const page = stagehand . page ;
14
+ try {
15
+ await page . goto (
16
+ "https://browserbase.github.io/stagehand-eval-sites/sites/closed-shadow-dom-in-spif/" ,
17
+ ) ;
18
+ await page . act ( { action : "click the button" , iframes : true } ) ;
19
+
20
+ const extraction = await page . extract ( {
21
+ instruction : "extract the entire page text" ,
22
+ iframes : true ,
23
+ } ) ;
24
+
25
+ const pageText = extraction . extraction ;
26
+
27
+ if ( pageText . includes ( "button successfully clicked" ) ) {
28
+ return {
29
+ _success : true ,
30
+ message : `successfully clicked the button` ,
31
+ debugUrl,
32
+ sessionUrl,
33
+ logs : logger . getLogs ( ) ,
34
+ } ;
35
+ }
36
+ return {
37
+ _success : false ,
38
+ message : `unable to click on the button` ,
39
+ debugUrl,
40
+ sessionUrl,
41
+ logs : logger . getLogs ( ) ,
42
+ } ;
43
+ } catch ( error ) {
44
+ return {
45
+ _success : false ,
46
+ message : `error: ${ error . message } ` ,
47
+ debugUrl,
48
+ sessionUrl,
49
+ logs : logger . getLogs ( ) ,
50
+ } ;
51
+ } finally {
52
+ await stagehand . close ( ) ;
53
+ }
54
+ } ;
Original file line number Diff line number Diff line change
1
+ import { EvalFunction } from "@/types/evals" ;
2
+
3
+ export const oopif_in_csr : EvalFunction = async ( {
4
+ debugUrl,
5
+ sessionUrl,
6
+ stagehand,
7
+ logger,
8
+ } ) => {
9
+ // this eval is designed to test whether stagehand can successfully
10
+ // fill a form inside a OOPIF (out of process iframe) that is inside an
11
+ // CSR (closed mode shadow) root
12
+
13
+ const page = stagehand . page ;
14
+ try {
15
+ await page . goto (
16
+ "https://browserbase.github.io/stagehand-eval-sites/sites/oopif-in-open-shadow-dom/" ,
17
+ ) ;
18
+ await page . act ( {
19
+ action : "fill 'nunya' into the first name field" ,
20
+ iframes : true ,
21
+ } ) ;
22
+
23
+ const extraction = await page . extract ( {
24
+ instruction : "extract the entire page text" ,
25
+ iframes : true ,
26
+ } ) ;
27
+
28
+ const pageText = extraction . extraction ;
29
+
30
+ if ( pageText . includes ( "nunya" ) ) {
31
+ return {
32
+ _success : true ,
33
+ message : `successfully filled the form` ,
34
+ debugUrl,
35
+ sessionUrl,
36
+ logs : logger . getLogs ( ) ,
37
+ } ;
38
+ }
39
+ return {
40
+ _success : false ,
41
+ message : `unable to fill the form` ,
42
+ debugUrl,
43
+ sessionUrl,
44
+ logs : logger . getLogs ( ) ,
45
+ } ;
46
+ } catch ( error ) {
47
+ return {
48
+ _success : false ,
49
+ message : `error: ${ error . message } ` ,
50
+ debugUrl,
51
+ sessionUrl,
52
+ logs : logger . getLogs ( ) ,
53
+ } ;
54
+ } finally {
55
+ await stagehand . close ( ) ;
56
+ }
57
+ } ;
Original file line number Diff line number Diff line change
1
+ import { EvalFunction } from "@/types/evals" ;
2
+
3
+ export const oopif_in_osr : EvalFunction = async ( {
4
+ debugUrl,
5
+ sessionUrl,
6
+ stagehand,
7
+ logger,
8
+ } ) => {
9
+ // this eval is designed to test whether stagehand can successfully
10
+ // fill a form inside a OOPIF (out of process iframe) that is inside an
11
+ // OSR (open mode shadow) root
12
+
13
+ const page = stagehand . page ;
14
+ try {
15
+ await page . goto (
16
+ "https://browserbase.github.io/stagehand-eval-sites/sites/oopif-in-open-shadow-dom/" ,
17
+ ) ;
18
+ await page . act ( {
19
+ action : "fill 'nunya' into the first name field" ,
20
+ iframes : true ,
21
+ } ) ;
22
+
23
+ const extraction = await page . extract ( {
24
+ instruction : "extract the entire page text" ,
25
+ iframes : true ,
26
+ } ) ;
27
+
28
+ const pageText = extraction . extraction ;
29
+
30
+ if ( pageText . includes ( "nunya" ) ) {
31
+ return {
32
+ _success : true ,
33
+ message : `successfully filled the form` ,
34
+ debugUrl,
35
+ sessionUrl,
36
+ logs : logger . getLogs ( ) ,
37
+ } ;
38
+ }
39
+ return {
40
+ _success : false ,
41
+ message : `unable to fill the form` ,
42
+ debugUrl,
43
+ sessionUrl,
44
+ logs : logger . getLogs ( ) ,
45
+ } ;
46
+ } catch ( error ) {
47
+ return {
48
+ _success : false ,
49
+ message : `error: ${ error . message } ` ,
50
+ debugUrl,
51
+ sessionUrl,
52
+ logs : logger . getLogs ( ) ,
53
+ } ;
54
+ } finally {
55
+ await stagehand . close ( ) ;
56
+ }
57
+ } ;
Original file line number Diff line number Diff line change
1
+ import { EvalFunction } from "@/types/evals" ;
2
+
3
+ export const osr_in_oopif : EvalFunction = async ( {
4
+ debugUrl,
5
+ sessionUrl,
6
+ stagehand,
7
+ logger,
8
+ } ) => {
9
+ // this eval is designed to test whether stagehand can successfully
10
+ // click inside an OSR (open mode shadow) root that is inside an
11
+ // OOPIF (out of process iframe)
12
+
13
+ const page = stagehand . page ;
14
+ try {
15
+ await page . goto (
16
+ "https://browserbase.github.io/stagehand-eval-sites/sites/open-shadow-root-in-oopif/" ,
17
+ ) ;
18
+ await page . act ( { action : "click the button" , iframes : true } ) ;
19
+
20
+ const extraction = await page . extract ( {
21
+ instruction : "extract the entire page text" ,
22
+ iframes : true ,
23
+ } ) ;
24
+
25
+ const pageText = extraction . extraction ;
26
+
27
+ if ( pageText . includes ( "button successfully clicked" ) ) {
28
+ return {
29
+ _success : true ,
30
+ message : `successfully clicked the button` ,
31
+ debugUrl,
32
+ sessionUrl,
33
+ logs : logger . getLogs ( ) ,
34
+ } ;
35
+ }
36
+ return {
37
+ _success : false ,
38
+ message : `unable to click on the button` ,
39
+ debugUrl,
40
+ sessionUrl,
41
+ logs : logger . getLogs ( ) ,
42
+ } ;
43
+ } catch ( error ) {
44
+ return {
45
+ _success : false ,
46
+ message : `error: ${ error . message } ` ,
47
+ debugUrl,
48
+ sessionUrl,
49
+ logs : logger . getLogs ( ) ,
50
+ } ;
51
+ } finally {
52
+ await stagehand . close ( ) ;
53
+ }
54
+ } ;
Original file line number Diff line number Diff line change
1
+ import { EvalFunction } from "@/types/evals" ;
2
+
3
+ export const osr_in_spif : EvalFunction = async ( {
4
+ debugUrl,
5
+ sessionUrl,
6
+ stagehand,
7
+ logger,
8
+ } ) => {
9
+ // this eval is designed to test whether stagehand can successfully
10
+ // click inside an OSR (open mode shadow) root that is inside an
11
+ // SPIF (same process iframe)
12
+
13
+ const page = stagehand . page ;
14
+ try {
15
+ await page . goto (
16
+ "https://browserbase.github.io/stagehand-eval-sites/sites/open-shadow-root-in-spif/" ,
17
+ ) ;
18
+ await page . act ( { action : "click the button" , iframes : true } ) ;
19
+
20
+ const extraction = await page . extract ( {
21
+ instruction : "extract the entire page text" ,
22
+ iframes : true ,
23
+ } ) ;
24
+
25
+ const pageText = extraction . extraction ;
26
+
27
+ if ( pageText . includes ( "button successfully clicked" ) ) {
28
+ return {
29
+ _success : true ,
30
+ message : `successfully clicked the button` ,
31
+ debugUrl,
32
+ sessionUrl,
33
+ logs : logger . getLogs ( ) ,
34
+ } ;
35
+ }
36
+ return {
37
+ _success : false ,
38
+ message : `unable to click on the button` ,
39
+ debugUrl,
40
+ sessionUrl,
41
+ logs : logger . getLogs ( ) ,
42
+ } ;
43
+ } catch ( error ) {
44
+ return {
45
+ _success : false ,
46
+ message : `error: ${ error . message } ` ,
47
+ debugUrl,
48
+ sessionUrl,
49
+ logs : logger . getLogs ( ) ,
50
+ } ;
51
+ } finally {
52
+ await stagehand . close ( ) ;
53
+ }
54
+ } ;
You can’t perform that action at this time.
0 commit comments