Skip to main content

search

codebolt.browser.search(elementid: string, query: string): Promise<unknown>
Performs a search on the current page using a specified query.

Parameters

NameTypeDescription
elementidstringThe ID of the element to perform the search in.
querystringThe search query.

Returns:

 Promise<unknown>
A promise that resolves with the search results.

Example


// Perform a search using the search box element with ID "searchBox" and query "example query"
const searchResults = await codebolt.browser.search("searchBox", "example query");

// Process the search results (e.g., validate or extract data)
console.log(searchResults);

Explanation

The codebolt.browser.search(elementid: string, query: string) function is used to perform a search on the current page using a specified query. This function allows automation scripts to search for specific content or elements within the page.