Finding Elements
Sometimes you need direct access to elements instead of using Alumnium’s autonomous actions. The find() method locates elements using natural language descriptions and returns native driver elements that you can interact with directly.
submit_button = al.find("submit button")submit_button.click()
text_input = al.find("text input")text_input.send_keys("Hello Alumnium!")import type { WebElement } from "selenium-webdriver";
const submitButton = await al.find("submit button");await submitButton.click();
// Typecast to framework-specific elementconst textInput = (await al.find("text input")) as WebElement;await textInput.sendKeys("Hello Alumnium!");The returned element is a native driver element (Appium/Selenium WebElement or Playwright Locator), so you can use all standard methods from your testing framework.
Use find() when you need to:
- Access element properties or attributes
- Use framework-specific methods
- Work with test fixtures that expect native elements
- Get precise control over interactions
# Getting element textprice = al.find("total price")total = float(price.text.replace("$", ""))assert total > 0
# Using framework-specific methodsbutton = al.find("dropdown menu")assert button.is_displayed()import type { WebElement } from "selenium-webdriver";
// Getting element textconst price = (await al.find("total price")) as WebElement;const total = parseFloat((await price.getText()).replace("$", ""));expect(total).toBeGreaterThan(0);
// Using framework-specific methodsconst button = (await al.find("dropdown menu")) as WebElement;expect(await button.isDisplayed()).toBe(true);For simple interactions where you don’t need the element reference, use do() instead.