@sentry/junior-agent-browser 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ #!/bin/bash
2
+ # Template: Content Capture Workflow
3
+ # Purpose: Extract content from web pages (text, screenshots, PDF)
4
+ # Usage: ./capture-workflow.sh <url> [output-dir]
5
+ #
6
+ # Outputs:
7
+ # - page-full.png: Full page screenshot
8
+ # - page-structure.txt: Page element structure with refs
9
+ # - page-text.txt: All text content
10
+ # - page.pdf: PDF version
11
+ #
12
+ # Optional: Load auth state for protected pages
13
+
14
+ set -euo pipefail
15
+
16
+ TARGET_URL="${1:?Usage: $0 <url> [output-dir]}"
17
+ OUTPUT_DIR="${2:-.}"
18
+
19
+ echo "Capturing: $TARGET_URL"
20
+ mkdir -p "$OUTPUT_DIR"
21
+
22
+ # Optional: Load authentication state
23
+ # if [[ -f "./auth-state.json" ]]; then
24
+ # echo "Loading authentication state..."
25
+ # agent-browser state load "./auth-state.json"
26
+ # fi
27
+
28
+ # Navigate to target
29
+ agent-browser open "$TARGET_URL"
30
+ agent-browser wait --load networkidle
31
+
32
+ # Get metadata
33
+ TITLE=$(agent-browser get title)
34
+ URL=$(agent-browser get url)
35
+ echo "Title: $TITLE"
36
+ echo "URL: $URL"
37
+
38
+ # Capture full page screenshot
39
+ agent-browser screenshot --full "$OUTPUT_DIR/page-full.png"
40
+ echo "Saved: $OUTPUT_DIR/page-full.png"
41
+
42
+ # Get page structure with refs
43
+ agent-browser snapshot -i > "$OUTPUT_DIR/page-structure.txt"
44
+ echo "Saved: $OUTPUT_DIR/page-structure.txt"
45
+
46
+ # Extract all text content
47
+ agent-browser get text body > "$OUTPUT_DIR/page-text.txt"
48
+ echo "Saved: $OUTPUT_DIR/page-text.txt"
49
+
50
+ # Save as PDF
51
+ agent-browser pdf "$OUTPUT_DIR/page.pdf"
52
+ echo "Saved: $OUTPUT_DIR/page.pdf"
53
+
54
+ # Optional: Extract specific elements using refs from structure
55
+ # agent-browser get text @e5 > "$OUTPUT_DIR/main-content.txt"
56
+
57
+ # Optional: Handle infinite scroll pages
58
+ # for i in {1..5}; do
59
+ # agent-browser scroll down 1000
60
+ # agent-browser wait 1000
61
+ # done
62
+ # agent-browser screenshot --full "$OUTPUT_DIR/page-scrolled.png"
63
+
64
+ # Cleanup
65
+ agent-browser close
66
+
67
+ echo ""
68
+ echo "Capture complete:"
69
+ ls -la "$OUTPUT_DIR"
@@ -0,0 +1,62 @@
1
+ #!/bin/bash
2
+ # Template: Form Automation Workflow
3
+ # Purpose: Fill and submit web forms with validation
4
+ # Usage: ./form-automation.sh <form-url>
5
+ #
6
+ # This template demonstrates the snapshot-interact-verify pattern:
7
+ # 1. Navigate to form
8
+ # 2. Snapshot to get element refs
9
+ # 3. Fill fields using refs
10
+ # 4. Submit and verify result
11
+ #
12
+ # Customize: Update the refs (@e1, @e2, etc.) based on your form's snapshot output
13
+
14
+ set -euo pipefail
15
+
16
+ FORM_URL="${1:?Usage: $0 <form-url>}"
17
+
18
+ echo "Form automation: $FORM_URL"
19
+
20
+ # Step 1: Navigate to form
21
+ agent-browser open "$FORM_URL"
22
+ agent-browser wait --load networkidle
23
+
24
+ # Step 2: Snapshot to discover form elements
25
+ echo ""
26
+ echo "Form structure:"
27
+ agent-browser snapshot -i
28
+
29
+ # Step 3: Fill form fields (customize these refs based on snapshot output)
30
+ #
31
+ # Common field types:
32
+ # agent-browser fill @e1 "John Doe" # Text input
33
+ # agent-browser fill @e2 "user@example.com" # Email input
34
+ # agent-browser fill @e3 "SecureP@ss123" # Password input
35
+ # agent-browser select @e4 "Option Value" # Dropdown
36
+ # agent-browser check @e5 # Checkbox
37
+ # agent-browser click @e6 # Radio button
38
+ # agent-browser fill @e7 "Multi-line text" # Textarea
39
+ # agent-browser upload @e8 /path/to/file.pdf # File upload
40
+ #
41
+ # Uncomment and modify:
42
+ # agent-browser fill @e1 "Test User"
43
+ # agent-browser fill @e2 "test@example.com"
44
+ # agent-browser click @e3 # Submit button
45
+
46
+ # Step 4: Wait for submission
47
+ # agent-browser wait --load networkidle
48
+ # agent-browser wait --url "**/success" # Or wait for redirect
49
+
50
+ # Step 5: Verify result
51
+ echo ""
52
+ echo "Result:"
53
+ agent-browser get url
54
+ agent-browser snapshot -i
55
+
56
+ # Optional: Capture evidence
57
+ agent-browser screenshot /tmp/form-result.png
58
+ echo "Screenshot saved: /tmp/form-result.png"
59
+
60
+ # Cleanup
61
+ agent-browser close
62
+ echo "Done"