Take your existing framework and make it smarter
1) Get your API key
Sign-Up/Login to the dashboard, and get your API key from the top right side.
Note
You can click the copy icon to quickly copy it to your clipboard
2) Install SmartDriver
- Python (selenium)
- Java (Selenium)
- C# (Selenium)
- JavaScript (Selenium)
- Cypress.io
pip install devtools-ai
pip install selenium
pip install webdriver_manager # Optional: Used to auto-install ChromeDriver
pom.xml (Maven)
<dependency>
<groupId>ai.dev-tools</groupId>
<artifactId>ai-devtools-selenium</artifactId>
<version>0.1.+</version>
</dependency>
build.gradle (Gradle)
implementation 'ai.dev-tools:ai-devtools-selenium:0.1.+'
Coming soon.
Coming soon.
npm i @devtools-ai/cypress-sdk
3) Run your first test case with Dev Tools
Below is a sample test case using DevTools. Note you only need 2 lines to make Dev Tools work
- Python (selenium)
- Java (Selenium)
- C# (Selenium)
- JavaScript (Selenium)
- Cypress.io
from time import sleep
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from devtools_ai.selenium import SmartDriver # Import Dev Tools
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 Google.com
driver.get("https://google.com")
sleep(1)
# Find the searchbox and send "hello world"
searchbox_element = driver.find_element(By.NAME, 'q')
searchbox_element.send_keys("hello world\n")
sleep(2)
driver.quit()
if __name__ == "__main__":
_main()
package my.awesome.pkg;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.By;
import io.github.bonigarcia.wdm.WebDriverManager;
import ai.devtools.selenium.SmartDriver; // Import DevTools
public class Example
{
public static void main(String[] args) throws Throwable
{
WebDriverManager.chromedriver().setup();
ChromeDriver chromeDriver = new ChromeDriver();
try
{
SmartDriver driver = new SmartDriver(chromeDriver, "??API_KEY??");
driver.get("https://google.com/");
Thread.sleep(1000);
WebElement searchBoxElement = driver.findElement(By.name("q"));
searchBoxElement.sendKeys("hello world\n");
Thread.sleep(1000);
}
finally
{
chromeDriver.quit();
}
}
}
Coming soon.
Coming soon.
describe("Should be able to login", () => {
it("Login", () => {
cy.visit("http://www.github.com/login");
cy.get("loginBox").type("mySampleEmail@gmail.com");
});
});
4) Run your test as normal
The first time you run the test, smartdriver will watch and learn from your test.
When selectors fail in the future, smartdriver will look at the page and identify the element visually.