Skip to content

Commit ef1f3e3

Browse files
committed
cbstate and chat, add explaination and example
1 parent 6f53603 commit ef1f3e3

24 files changed

+156
-150
lines changed

docs/api/browser/click.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ data:
2121
<CBBaseInfo/>
2222
<CBParameters/>
2323

24-
### Examples
24+
### Examples
2525

26-
```js
26+
```js
2727
// Using Codebolt's browser API, you can interact with elements on a web page.
2828
// For example, let's say there's a button with the ID "test" on the page.
2929
// You can use Codebolt's browser API to click on this button.
@@ -42,12 +42,11 @@ data:
4242
// Putting it all together:
4343
codebolt.browser.click("#test");
4444

45-
```
45+
```
4646

47-
### Explaination
47+
### Explaination
4848

4949
[Browser](../../concepts/browser) Click function is used to click on the browser by selecting specific elementId.
5050

51-
A browser is a used to access and display web pages on the internet. When a browser is open, users can interact with various elements on web pages, such as buttons, links, forms, and images.
51+
A browser is a used to access and display web pages. When a browser is open, users can interact with various elements on web pages, such as buttons, links, forms, and images.
5252

53-
One common action in web development and automation is clicking on specific elements within a web page. This action is typically performed by selecting the element using its unique identifier, often referred to as the element ID, and then triggering a click event on that element.

docs/api/browser/close.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ data:
3030
```
3131
### Explaination
3232

33-
Navigation: The script first opens a browser window/tab and navigates to the specified URL using codebolt.browser.goToPage(url). In this example, it navigates to "https://example.com".
34-
35-
Testing: Once on the web page, the script performs various tests to validate the functionality of the application.
36-
37-
Closing the Page: After completing the tests on the current page, the codebolt.browser.close() function is used to close the current page/tab. This action is useful for cleaning up after testing is complete and for ensuring that the browser environment is left in a desired state.
33+
The script first opens a browser window/tab and navigates to the specified URL using codebolt.browser.goToPage(url). In this example, it navigates to "https://example.com".
3834

35+
After completing the task on the current page, the codebolt.browser.close() function is used to close the current page.
3936

4037

docs/api/browser/enter.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,4 @@ await codebolt.browser.enter();
3838

3939
### Explanation:
4040

41-
Navigation: The script navigates to the sign-in page of the website.
42-
43-
Entering Data: Using codebolt.browser.type(), the script fills in the username and password fields with the appropriate credentials.
44-
45-
Simulating Enter Key Press: Instead of clicking a submit button, the script uses codebolt.browser.enter() to simulate pressing the Enter key. This action triggers the default submission behavior of the form, submitting the entered username and password for authentication.
41+
The codebolt.browser.enter() function is used to submit the form. Suppose there is a login form and I want to automatically submit it using a script. Then, we want to send text to a username field on the login page using the type() function, which has two parameters: eventid and "value". After inputting all the information, we call enter() to submit the form.

docs/api/browser/extractText.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,5 @@ console.log(pageText);
3232

3333
### Explaination:
3434

35-
Navigation: The script starts by navigating to the news website's homepage using codebolt.browser.goToPage("https://example-news.com").
35+
If we want to extract all the text on the webpage, we can use the codebolt.browser.extractText() function. This function returns the text, which we can store in a variable and use.
3636

37-
Text Extraction: Once the page has loaded, the script uses codebolt.browser.extractText() to extract all the text content from the current page. This function captures all textual information present on the web page, including headings, paragraphs, and any other text elements.
38-
39-
Processing the Extracted Text: The extracted text is stored in the variable pageText. In this example, the script simply logs the extracted text to the console using console.log(pageText). In a real-world scenario, you might further process this text to analyze news headlines, summarize content, or extract specific information.

docs/api/browser/getContent.md

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

19-
### Examples:
2019

21-
```js
20+
### Status
21+
Working Progress...
2222

23-
// Navigate to the blog page
24-
await codebolt.browser.goToPage("https://example-blog.com/article")
25-
26-
// Retrieve the HTML content of the current page
27-
const pageContent = await codebolt.browser.getContent()
28-
29-
// Log the retrieved content to the console (or save it as needed)
30-
console.log(pageContent)
31-
32-
```
33-
34-
### Explanation:
35-
The codebolt.browser.getContent() function is used to retrieve the entire HTML content of the current web page. This function is particularly useful in web scraping, data extraction, and automated testing scenarios where you need to capture the full structure and content of a web page for further processing or analysis.
36-
37-
### Explaination of the code:
38-
39-
Navigation: The script begins by navigating to the specific blog page using codebolt.browser.goToPage("https://example-blog.com/article").
40-
41-
Content Retrieval: Once the page has fully loaded, the script uses codebolt.browser.getContent() to retrieve the complete HTML content of the current page. This includes all HTML tags, embedded styles, scripts, and textual content.
42-
43-
Processing the Retrieved Content: The retrieved HTML content is stored in the variable pageContent. In this example, the script logs the HTML content to the console using console.log(pageContent). In a real-world scenario, you might save this content to a file or a database for later analysis or offline access.

docs/api/browser/getHTML.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ data:
1818
<CBBaseInfo/>
1919
<CBParameters/>
2020

21+
2122
### Examples :
2223

2324
```js
@@ -37,11 +38,3 @@ console.log(htmlContent)
3738

3839
The codebolt.browser.getHTML() function is used to retrieve the HTML content of the current web page. This function is particularly useful for web scraping, data extraction, and automated testing scenarios where you need to capture the entire HTML structure and content of a web page for further analysis or processing.
3940

40-
41-
### Explaination of the code:
42-
43-
Navigation: The script begins by navigating to the specific blog page using codebolt.browser.goToPage("https://example-blog.com/article").
44-
45-
HTML Content Retrieval: Once the page has fully loaded, the script uses codebolt.browser.getHTML() to retrieve the complete HTML content of the current page. The function returns a promise that resolves to the HTML content, which includes all HTML tags, embedded styles, scripts, and textual content.
46-
47-
Processing the Retrieved HTML: The retrieved HTML content is stored in the variable htmlContent. In this example, the script logs the HTML content to the console using console.log(htmlContent). Additionally, the example demonstrates how to save the HTML content to a file using Node.js's file system module (fs), which writes the HTML content to a file named product-page.html.

docs/api/browser/getMarkdown.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ console.log(markdownContent);
3939
The codebolt.browser.getMarkdown() function is used to retrieve the Markdown representation of the content on the current web page. This function is particularly useful for converting HTML content into a more readable and editable Markdown format, which is widely used in documentation, blogging, and content management systems.
4040

4141

42-
### Explanation of the Code
43-
44-
Navigation: The script starts by navigating to a specific blog post page using codebolt.browser.goToPage("https://example-blog.com/post/12345").
45-
46-
47-
Markdown Content Retrieval: Once the page has fully loaded, the script uses codebolt.browser.getMarkdown() to retrieve the content of the current page in Markdown format. This function converts the HTML content into Markdown, capturing the structure and text in a more readable format.
48-
49-
50-
Processing the Retrieved Markdown: The retrieved Markdown content is stored in the variable markdownContent. In this example, the script logs the Markdown content to the console using console.log(markdownContent). Additionally, the example demonstrates how to save the Markdown content to a file using Node.js's file system module (fs), which writes the content to a file named post.md.
51-
5242

5343

5444

docs/api/browser/getPDF.md

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

19-
### Examples:
2019

21-
```js
20+
### Status
21+
Working Progress...
2222

23-
// Navigate to the news article page
24-
await codebolt.browser.goToPage("https://example-news.com/article/12345");
25-
26-
// Retrieve the PDF content of the current page
27-
const pdfContent = await codebolt.browser.getPDF();
28-
29-
// Log a message to indicate the PDF has been retrieved (optional)
30-
console.log("PDF content retrieved successfully");
31-
32-
```
33-
34-
35-
### Explanation
36-
37-
The codebolt.browser.getPDF() function is used to retrieve a PDF representation of the current web page. This function is particularly useful for generating PDF versions of web pages for documentation, archiving, or sharing purposes. It captures the visual layout and content of the web page as a PDF file.
38-
39-
40-
41-
### Explanation of the Code
42-
43-
Navigation: The script starts by navigating to a specific news article page using codebolt.browser.goToPage("https://example-news.com/article/12345").
44-
45-
PDF Content Retrieval: Once the page has fully loaded, the script uses codebolt.browser.getPDF() to retrieve the content of the current page as a PDF. This function captures the entire visual layout and content of the page, creating a PDF file that mirrors the web page's appearance.
46-
47-
Processing the Retrieved PDF: The retrieved PDF content is stored in the variable pdfContent. In this example, the script logs a message to the console to indicate that the PDF has been successfully retrieved.

docs/api/browser/getUrl.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,4 @@ console.log(`Current URL: ${currentUrl}`);
3434

3535
### Explanation
3636

37-
The codebolt.browser.getUrl() function is used to retrieve the URL of the current active page in the browser. This function is useful in web automation, testing, and navigation scenarios where you need to confirm or log the URL of the page that the browser is currently displaying.
38-
39-
40-
### Explanation of the Code
41-
Navigation to Home Page: The script begins by navigating to the home page of the website using codebolt.browser.goToPage("https://example-website.com").
42-
43-
Retrieving the Current URL: After the page has loaded, the script uses codebolt.browser.getUrl() to retrieve the current URL of the browser's active page. The retrieved URL is stored in the variable currentUrl.
44-
37+
The codebolt.browser.getUrl() function is used to retrieve the URL of the current web page in the browser. This function returns the url, which we can store in a variable and use.

docs/api/browser/pdfToText.md

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

19-
### Examples:
19+
20+
### Status
21+
22+
Working Progress...
23+
24+
<!-- ### Examples:
2025
2126
```js
2227
@@ -29,4 +34,4 @@ codebolt.browser.pdfToText();
2934
```
3035
3136
### Explanation
32-
The codebolt.browser.pdfToText() function is used to convert the PDF content of the current page into text format. This function is particularly useful when dealing with PDF documents in web automation or data extraction scenarios where you need to extract textual information from PDF files.
37+
The codebolt.browser.pdfToText() function is used to convert the PDF content of the current page into text format. This function is particularly useful when dealing with PDF documents in web automation or data extraction scenarios where you need to extract textual information from PDF files. -->

0 commit comments

Comments
 (0)