Link

The Link class provides a clean interface for interacting with generic container elements such as <link> blocks. It includes methods for selection, assertions, and scrolling into view.

🧩 Code

The Link class is designed to interact with common link element

To insert a code block with syntax highlighting:

import { oi } from "@ordino.ai/spartify-engine";

oi.ui.link(this.lnk_element).click()

Methods

click(): void Clicks the link.

@returns void

oi.ui.link(this.lnk_element).click()

forceClick(): void Forces a click on the link.

@returns void

oi.ui.link(this.lnk_element).forceClick()

doubleClick(forceClick:boolean): void Double-clicks the link @param forceClick {boolean} the value to match.(Optional)

@returns void

oi.ui.link(this.lnk_element).doubleClick(true)

rightClick(forceClick:boolean): void Right-clicks the link. @param forceClick {boolean} the value to match.(Optional)

@returns void

oi.ui.link(this.lnk_element).rightClick(true)

clickLinkAtCoordinates(x: number, y: number, forceClick:boolean): void Clicks the link at the specified coordinates. @param x - The x-coordinate. @param y - The y-coordinate.

@returns void

oi.ui.link(this.lnk_element).clickLinkAtCoordinates(1,2)

centerClick(forceClick:boolean): void Clicks the link at its center.

@returns void

oi.ui.link(this.lnk_element).centerClick(true)

clickFirst(forceClick:boolean): void Clicks the first link.

@returns void

oi.ui.link(this.lnk_element).clickFirst(true)

clickLast(forceClick:boolean): void Clicks the last link.

@returns void

oi.ui.link(this.lnk_element).clickLast(true)

getLinkHref(): void Gets the href attribute of the link.

@returns promise

oi.ui.link(this.lnk_element).getLinkHref()

Assertions

isVisible(): boolean Asserts that the link is visible.

@returns boolean

oi.ui.link(this.txt_element).isVisible()

isHidden(): boolean Asserts that the link is hidden

@returns boolean

oi.ui.link(this.lnk_element).isHidden()

assertLinkHrefContains(text: string): void Asserts that the href attribute of the link contains the specified text. @param text - the text to check for in the href attribute.

@returns void

oi.ui.link(this.lnk_username).assertLinkHrefContains('text')

assertLinkHrefEquals(href: string): void Asserts that the href attribute of the link equals the specified href. @param href - the href to compare with the link’s href attribute

@returns void

oi.ui.link(this.lnk_element).assertLinkHrefEquals('text')

assertLinkText(text: string): void Asserts that the text of the link equals the specified text. @param text - the text to compare with the link’s text.

@returns void

oi.ui.link(this.lnk_element).assertLinkText('text')

isDisabled(): void Checks if the element is disabled.

@returns boolean

oi.ui.link(this.lnk_username).isDisabled()

isDisplayed(): Promise<boolean> Checks if the element is displayed

@returns boolean

oi.ui.link(this.lnk_username).isDisplayed()

isFocused(): Promise<boolean> Checks if the element is focused

@returns boolean

oi.ui.link(this.lnk_username).isFocused()

isHidden(): Promise<boolean> Asserts that the link is hidden.

@returns void

oi.ui.link(this.lnk_username).isHidden()

isEnabled(): Promise<boolean> Checks if the element is enabled

@returns boolean

oi.ui.link(this.lnk_username).isEnabled()

Scrolling Actions

scrollToElement(): void

Scrolls to the link element.

@returns void

oi.ui.button(this.lnk_element).scrollToElement()

Custom Events

Ordino allows you to build custom actions or user journeys by directly interacting with the underlying tool’s native methods and actions.

This approach gives you full control, bypassing Ordino’s abstraction layer, and ensures you can leverage tool-specific capabilities as needed.

  • locator → The element locator (e.g., XPath, CSS selector, or tool-specific reference).

  • Returns → A tool element object on which you can invoke native actions (e.g., .click(), .type()).

// Generic pattern
element(locator): object

Ordino Custom Mode

Using Ordino’s direct tool method reference:

// Ordino direct-to-tool approach
oi.ui.element('@xpath').click()

Here, Ordino will call the Cypress (or other tool) element object directly, rather than going through Ordino’s wrapper.

Building User Journeys

By chaining multiple oi.ui.element() calls, you can construct full user journeys while still working with native tool methods.

Example: Login Flow

// Enter username
oi.ui.element('//input[@id="username"]').forceClick()

// Enter password
oi.ui.element('//input[@id="password"]').isVisible()

// Click login button
oi.ui.element('(//*[contains(text(),"Login")])[1]').click()

Key Notes

  • Use this mode when you need maximum control over the test framework.

  • This does not abstract or transform the call – it executes directly on the tool object (e.g., Cypress, Playwright, etc.).

  • Perfect for custom journeys, advanced locators, or tool-specific actions not exposed by Ordino’s higher-level API.

Last updated