copy Copy chevron-down
code SDK Referencechevron-right toggle-off ComponentsBrowser The Browser class in Ordino AI provides a suite of browser-level automation capabilities. It allows seamless interaction with browser windows, navigation, alerts, cookies, and more.
Usage : browser
The Browser class is designed to interact with the browser
To insert a code block with syntax highlighting:
Copy import { oi } from " @ordino.ai/spartify-engine " ;
oi . ui . browser () . navigateToUrl ( ' https://ordino.ai ' ) ;
Copy import { oi } from " @ordino.ai/spartify-engine " ;
await oi . ui ( this . page ) . browser () . navigateToUrl ( ' https://ordino ' ) Navigation Methods
navigateToUrl(url: string): void
Navigates to the specified URL.
@param url – The URL to navigate to.
Copy oi . ui . browser () . navigateToUrl ( ' https://ordino.ai ' ) ;
Copy await oi . ui ( this . page ) . browser () . navigateToUrl ( ' https://ordino.ai ' ) ; refreshPage(): void
Refreshes the current page.
goBack(): void
Navigates back to the previous page.
goForward(): void
Navigates forward to the next page.
getCurrentUrl(): Chainable<String>
Retrieves the current URL
getPageTitle(): Chainable<String>
Retrieves the title of the current page.
assertUrl(expectedUrl: <String>): void
Asserts that the current URL matches the specified URL.
@param url – The URL to navigate to.
assertPageTitle(expectedTitle: <String>): void
Asserts that the current page title matches the specified title.
@param title – The title to assert
Browser Session & Storage
clearBrowserCache: void
Clears the browser cache.
clearBrowserCookies: void
Clears the browser cookies.
setBrowserCookie(name: string, value: string): void
Sets a browser cookie with the specified name and value.
@param name – The name of the cookie.
@param value – The value of the cookie.
getBrowserCookies(): Chainable<Cookie[]>
Retrieves all browser cookies.
Window & Frame Actions
setWindowSize(width: number, height: number): void
Sets the size of the browser window.
@param width – The width of the window.
@param height – The height of the window.
switchToWindow(windowName: string): void
Switches to the specified window.
switchToFrame(frameName: any): void
Retrieves all browser cookies.
@param frame-name - The name or index of the frame to switch to.
closeCurrentWindow(): void
Closes the current window.
openNewTab(url: string): void
Opens a new tab with the specified URL.
@param url - The url to open in the new tab.
assertBrowserIsOpen(): void
Asserts that the browser is open.
Screenshots & Alerts
takeScreenshot(fileName: string): void
Takes a screenshot and saves it with the specified file name.
@param file-name - The name of the file to save the screenshot as
takeFullPageScreenshot(fileName: string): void
Takes a full-page screenshot and saves it with the specified file name.
@param frame-name - The name of the file to save the full-page screenshot as.
handleAlert(alertText: string, action: string): void
Handles an alert with the specified text and action.
@param alert-text - the text of the alert.
@param action - The action to take on the alert (e.g., accept, dismiss).
Network Handling
waitForNetworkIdle(): void
Waits for the network to be idle.
@param frame-name - The name or index of the frame to switch to.
Last updated 7 months ago