Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5f23ce1

Browse files
committed
updated docs
1 parent7250e75 commit5f23ce1

File tree

67 files changed

+4361
-1345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+4361
-1345
lines changed

‎docs/api/apiaccess/browser/click.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,23 @@ data:
1919
<CBBaseInfo/>
2020
<CBParameters/>
2121

22+
###Response Structure
23+
24+
The method returns a Promise that resolves to a`BrowserActionResponseData` object with the following properties:
25+
26+
-**`type`** (string): Always "clickResponse".
27+
-**`payload`** (object, optional): Contains the response data including:
28+
-**`action`** (string, optional): The action that was performed
29+
-**`success`** (boolean, optional): Indicates if the click was successful
30+
-**`content`** (string, optional): Additional content information
31+
-**`viewport`** (object, optional): Current viewport information
32+
-**`eventId`** (string, optional): Event identifier for the click action
33+
-**`success`** (boolean, optional): Indicates if the operation was successful
34+
-**`message`** (string, optional): A message with additional information
35+
-**`error`** (string, optional): Error details if the operation failed
36+
-**`messageId`** (string, optional): A unique identifier for the message
37+
-**`threadId`** (string, optional): The thread identifier
38+
2239
###Example
2340

2441
```js
@@ -30,10 +47,23 @@ await new Promise(resolve => setTimeout(resolve, 2000));
3047
constclickResult=awaitcodebolt.browser.click("submit-btn");
3148
console.log('✅ Clicked:', clickResult);
3249

50+
// Check if the click was successful
51+
if (clickResult.success) {
52+
console.log('Click action completed successfully');
53+
}else {
54+
console.error('Click failed:',clickResult.error);
55+
}
56+
3357
// Click on a link with a specific ID
3458
awaitcodebolt.browser.click("nav-link");
3559

3660
// Click on a checkbox or radio button
3761
awaitcodebolt.browser.click("checkbox-id");
3862
```
3963

64+
###Notes
65+
66+
- The`elementid` parameter must correspond to an existing element ID on the current page
67+
- The element must be visible and clickable for the operation to succeed
68+
- The response provides confirmation of the click action and any relevant page state changes
69+

‎docs/api/apiaccess/browser/close.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ data:
1616
<CBBaseInfo/>
1717
<CBParameters/>
1818

19+
###Response Structure
20+
21+
This method returns`void` and does not provide a response. The browser page is closed immediately when the method is called.
22+
1923
###Example
2024

2125
```js
@@ -30,4 +34,11 @@ await new Promise(resolve => setTimeout(resolve, 2000));
3034
// Close the browser when done
3135
codebolt.browser.close();
3236
console.log('✅ Browser closed');
33-
```
37+
```
38+
39+
###Notes
40+
41+
- This method does not return a Promise and executes immediately
42+
- The browser page is closed without waiting for confirmation
43+
- Use this method when you're finished with browser automation to clean up resources
44+
- After closing, you'll need to call`newPage()` again to create a new browser session

‎docs/api/apiaccess/browser/enter.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ data:
1616
<CBBaseInfo/>
1717
<CBParameters/>
1818

19+
###Response Structure
20+
21+
The method returns a Promise that resolves to a`BrowserActionResponseData` object with the following properties:
22+
23+
-**`type`** (string): Always "EnterResponse".
24+
-**`payload`** (object, optional): Contains the response data including:
25+
-**`action`** (string, optional): The action that was performed
26+
-**`success`** (boolean, optional): Indicates if the Enter key press was successful
27+
-**`content`** (string, optional): Additional content information
28+
-**`viewport`** (object, optional): Current viewport information
29+
-**`eventId`** (string, optional): Event identifier for the Enter action
30+
-**`success`** (boolean, optional): Indicates if the operation was successful
31+
-**`message`** (string, optional): A message with additional information
32+
-**`error`** (string, optional): Error details if the operation failed
33+
-**`messageId`** (string, optional): A unique identifier for the message
34+
-**`threadId`** (string, optional): The thread identifier
35+
1936
###Example
2037

2138
```js
@@ -31,7 +48,20 @@ await codebolt.browser.type("password", "testpass");
3148
constenterResult=awaitcodebolt.browser.enter();
3249
console.log('✅ Enter key pressed:', enterResult);
3350

51+
// Check if the Enter key press was successful
52+
if (enterResult.success) {
53+
console.log('Enter key pressed successfully');
54+
}else {
55+
console.error('Enter key press failed:',enterResult.error);
56+
}
57+
3458
// Alternative usage: after typing in a search box
3559
awaitcodebolt.browser.type("search-input","search query");
3660
awaitcodebolt.browser.enter();// Submit the search
3761
```
62+
63+
###Notes
64+
65+
- The Enter key press is applied to the currently focused element on the page
66+
- This is commonly used to submit forms or trigger search functionality
67+
- Ensure the appropriate element has focus before calling this method

‎docs/api/apiaccess/browser/extractText.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ data:
1616
<CBBaseInfo/>
1717
<CBParameters/>
1818

19+
###Response Structure
20+
21+
The method returns a Promise that resolves to an`ExtractTextResponse` object with the following properties:
22+
23+
-**`type`** (string): Always "extractTextResponse".
24+
-**`text`** (string, optional): The extracted text content from the current page
25+
-**`content`** (string, optional): Alternative property for the extracted text
26+
-**`success`** (boolean, optional): Indicates if the operation was successful
27+
-**`message`** (string, optional): A message with additional information
28+
-**`error`** (string, optional): Error details if the operation failed
29+
-**`messageId`** (string, optional): A unique identifier for the message
30+
-**`threadId`** (string, optional): The thread identifier
31+
1932
###Example
2033

2134
```js
@@ -36,6 +49,8 @@ console.log('✅ Text extracted:', {
3649
if (textResult.success&&textResult.text) {
3750
console.log('Extracted text:',textResult.text);
3851
// Process the text as needed for analysis or storage
52+
}else {
53+
console.error('Failed to extract text:',textResult.error);
3954
}
4055
```
4156

‎docs/api/apiaccess/browser/getBrowserInfo.md‎

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,34 @@ data:
1616
<CBBaseInfo/>
1717
<CBParameters/>
1818

19+
###Response Structure
20+
21+
The method returns a Promise that resolves to a`BrowserInfoResponse` object with the following properties:
22+
23+
-**`type`** (string): Always "getBrowserInfoResponse".
24+
-**`payload`** (object, optional): Contains the response data including:
25+
-**`info`** (object): Browser viewport information with the following properties:
26+
-**`width`** (number): Browser viewport width in pixels
27+
-**`height`** (number): Browser viewport height in pixels
28+
-**`devicePixelRatio`** (number): Device pixel ratio
29+
-**`scrollX`** (number): Horizontal scroll position
30+
-**`scrollY`** (number): Vertical scroll position
31+
-**`pageYOffset`** (number): Page Y offset
32+
-**`pageXOffset`** (number): Page X offset
33+
-**`windowWidth`** (number): Window width
34+
-**`windowHeight`** (number): Window height
35+
-**`offsetHeight`** (number): Element offset height
36+
-**`scrollHeight`** (number): Total scrollable height
37+
-**`success`** (boolean, optional): Indicates if the operation was successful
38+
-**`content`** (string, optional): Additional content information
39+
-**`viewport`** (object, optional): Alternative viewport information
40+
-**`eventId`** (string, optional): Event identifier for the action
41+
-**`success`** (boolean, optional): Indicates if the operation was successful
42+
-**`message`** (string, optional): A message with additional information
43+
-**`error`** (string, optional): Error details if the operation failed
44+
-**`messageId`** (string, optional): A unique identifier for the message
45+
-**`threadId`** (string, optional): The thread identifier
46+
1947
###Example
2048

2149
```js
@@ -30,8 +58,22 @@ const browserInfoResult = await codebolt.browser.getBrowserInfo();
3058
console.log('✅ Browser info:', browserInfoResult);
3159

3260
// The browser info contains viewport and scroll data
33-
if (browserInfoResult.success) {
34-
console.log('Browser dimensions and scroll position:', browserInfoResult);
35-
// Example output structure: { height: 800, width: 1200, scrollX: 0, scrollY: 50 }
61+
if (browserInfoResult.success&&browserInfoResult.payload?.info) {
62+
constinfo=browserInfoResult.payload.info;
63+
console.log('Browser dimensions and scroll position:', {
64+
width:info.width,
65+
height:info.height,
66+
scrollX:info.scrollX,
67+
scrollY:info.scrollY,
68+
scrollHeight:info.scrollHeight
69+
});
70+
}else {
71+
console.error('Failed to get browser info:',browserInfoResult.error);
3672
}
3773
```
74+
75+
### Notes
76+
77+
- The browser info provides comprehensive viewport and scroll information
78+
- This is useful for responsive design testing, scroll position tracking, and viewport-based automation
79+
- The response includes both current viewport dimensions and total page dimensions

‎docs/api/apiaccess/browser/getHTML.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ data:
1616
<CBBaseInfo/>
1717
<CBParameters/>
1818

19+
###Response Structure
20+
21+
The method returns a Promise that resolves to a`HtmlReceived` object with the following properties:
22+
23+
-**`type`** (string): Always "htmlReceived".
24+
-**`html`** (string, optional): The HTML content of the current page
25+
-**`content`** (string, optional): Alternative property for the HTML content
26+
-**`success`** (boolean, optional): Indicates if the operation was successful
27+
-**`message`** (string, optional): A message with additional information
28+
-**`error`** (string, optional): Error details if the operation failed
29+
-**`messageId`** (string, optional): A unique identifier for the message
30+
-**`threadId`** (string, optional): The thread identifier
31+
1932
###Example
2033

2134
```js
@@ -36,5 +49,13 @@ console.log('✅ HTML retrieved:', {
3649
if (htmlResult.success&&htmlResult.html) {
3750
console.log('HTML content:',htmlResult.html);
3851
// Process the HTML as needed
52+
}else {
53+
console.error('Failed to retrieve HTML:',htmlResult.error);
3954
}
4055
```
56+
57+
###Notes
58+
59+
- The HTML content includes the complete source code of the current page
60+
- This is useful for parsing page structure, extracting specific elements, or analyzing page content
61+
- The response may contain large amounts of data depending on the page size

‎docs/api/apiaccess/browser/getMarkdown.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ data:
1616
<CBBaseInfo/>
1717
<CBParameters/>
1818

19+
###Response Structure
20+
21+
The method returns a Promise that resolves to a`GetMarkdownResponse` object with the following properties:
22+
23+
-**`type`** (string): Always "getMarkdownResponse".
24+
-**`markdown`** (string, optional): The Markdown content of the current page
25+
-**`content`** (string, optional): Alternative property for the Markdown content
26+
-**`success`** (boolean, optional): Indicates if the operation was successful
27+
-**`message`** (string, optional): A message with additional information
28+
-**`error`** (string, optional): Error details if the operation failed
29+
-**`messageId`** (string, optional): A unique identifier for the message
30+
-**`threadId`** (string, optional): The thread identifier
31+
1932
###Example
2033

2134
```js
@@ -36,9 +49,17 @@ console.log('✅ Markdown retrieved:', {
3649
if (markdownResult.success&&markdownResult.markdown) {
3750
console.log('Markdown content:',markdownResult.markdown);
3851
// Save or process the Markdown as needed
52+
}else {
53+
console.error('Failed to retrieve Markdown:',markdownResult.error);
3954
}
4055
```
4156

57+
###Notes
58+
59+
- The Markdown content is a structured text representation of the page content
60+
- This is useful for documentation, content analysis, or converting web content to readable format
61+
- The conversion maintains the logical structure of headings, lists, links, and other elements
62+
4263

4364

4465

‎docs/api/apiaccess/browser/getPDF.md‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,28 @@ data:
1616
<CBBaseInfo/>
1717
<CBParameters/>
1818

19-
###Example
19+
###Response Structure
2020

21-
```js
21+
This method returns`void` and does not provide a response. The PDF generation is initiated immediately when the method is called.
2222

23-
awaitcodebolt.browser.goToPage("https://example-ecommerce.com/product/12345")
23+
###Example
2424

25+
```js
26+
// Navigate to a page
27+
awaitcodebolt.browser.goToPage("https://example-ecommerce.com/product/12345");
2528

26-
constgetPDF=awaitcodebolt.browser.getPDF()
29+
// Wait for page to load
30+
awaitnewPromise(resolve=>setTimeout(resolve,2000));
2731

32+
// Generate PDF of the current page
33+
codebolt.browser.getPDF();
34+
console.log('✅ PDF generation initiated');
2835
```
2936

30-
###Explaination
37+
###Notes
3138

32-
The codebolt.browser.getPDF() method is designed to capture the content of the current webpage and generate a PDF file from it. This is useful for saving web pages as PDFs for offline reading, documentation, or record-keeping.
39+
- This method does not return a Promise and executes immediately
40+
- The PDF generation is initiated without waiting for confirmation
41+
- The generated PDF is typically saved to the default download location
42+
- This is useful for saving web pages as PDFs for offline reading, documentation, or record-keeping
43+
- Ensure the page is fully loaded before calling this method for best results

‎docs/api/apiaccess/browser/getSnapShot.md‎

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,36 @@ data:
1616
<CBBaseInfo/>
1717
<CBParameters/>
1818

19+
###Response Structure
20+
21+
The method returns a Promise that resolves to a`BrowserSnapshotResponse` object with the following properties:
22+
23+
-**`type`** (string): Always "getSnapShotResponse".
24+
-**`payload`** (object, optional): Contains the response data including:
25+
-**`tree`** (object): DOM tree structure with the following properties:
26+
-**`strings`** (array): Array of strings used in the DOM tree
27+
-**`documents`** (array): Array of document objects containing:
28+
-**`nodes`** (object): Node information including:
29+
-**`backendNodeId`** (array): Backend node identifiers
30+
-**`attributes`** (array): Element attributes with name/value pairs
31+
-**`nodeValue`** (array): Node values
32+
-**`parentIndex`** (array): Parent node indices
33+
-**`nodeType`** (array): Node types
34+
-**`nodeName`** (array): Node names
35+
-**`isClickable`** (object): Clickable element information
36+
-**`textValue`** (object): Text content values
37+
-**`inputValue`** (object): Input field values
38+
-**`inputChecked`** (object): Checkbox/radio button states
39+
-**`success`** (boolean, optional): Indicates if the operation was successful
40+
-**`content`** (string, optional): Additional content information
41+
-**`viewport`** (object, optional): Viewport information
42+
-**`eventId`** (string, optional): Event identifier for the action
43+
-**`success`** (boolean, optional): Indicates if the operation was successful
44+
-**`message`** (string, optional): A message with additional information
45+
-**`error`** (string, optional): Error details if the operation failed
46+
-**`messageId`** (string, optional): A unique identifier for the message
47+
-**`threadId`** (string, optional): The thread identifier
48+
1949
###Example
2050

2151
```js
@@ -30,10 +60,24 @@ const snapshotResult = await codebolt.browser.getSnapShot();
3060
console.log('✅ Snapshot taken:', snapshotResult);
3161

3262
// The snapshot contains comprehensive page state information
33-
if (snapshotResult.success) {
34-
console.log('Snapshot data available for analysis');
63+
if (snapshotResult.success&&snapshotResult.payload?.tree) {
64+
consttree=snapshotResult.payload.tree;
65+
console.log('Snapshot data available for analysis:', {
66+
documentsCount:tree.documents?.length||0,
67+
stringsCount:tree.strings?.length||0,
68+
hasNodeData:!!tree.documents?.[0]?.nodes
69+
});
3570
// Process the snapshot data as needed
71+
}else {
72+
console.error('Failed to get snapshot:',snapshotResult.error);
3673
}
3774
```
3875
76+
### Notes
77+
78+
- The snapshot provides a complete structural representation of the page's DOM
79+
- This is useful for page analysis, element detection, and automated testing
80+
- The tree structure includes element hierarchy, attributes, and interactive states
81+
- The response contains detailed information about clickable elements and input values
82+
3983

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp