Skip to main content

Find By AI Method

SmartDriver adds additional methods to allow you to only use element names to find elements. This will return the Selenium Element that best matches the visual one.

Below is the same test case as the basic example where we will search for hello world on


You can write your entire test, and then execute it with interactive mode to quickly write larger tests.

from time import sleep

from selenium.webdriver import Chrome
from import Service
from import ChromeDriverManager

from devtools_ai.selenium import SmartDriver

def _main() -> None:
"""Main driver"""
chrome_driver = Chrome(service=Service(ChromeDriverManager().install()))

# Convert chrome_driver to smartDriver
driver = SmartDriver(chrome_driver, "??API_KEY??")

# Navigate to

# Find the searchbox and send "hello world"
searchbox_element = driver.find_by_ai("searchbox")
searchbox_element.send_keys("hello world\n")



if __name__ == "__main__":