Fully documented
![]() |
Award Winning
![]() |
Selenium Ecosystem
![]() |
|
🏃 Quick start guide ⤴
Tip
Recommended for new local sandbox projects.
- The easiest and most straightforward way to create a new project that uses SHAFT.
- Just follow the simple steps here ➡️ to generate your new project with one command (all configurations included).
Tip
Recommended if you're upgrading an existing project from Native Selenium WebDriver to SHAFT.
- Create a new Java/Maven project using the latest version from IntelliJ IDEA, Eclipse or your favourite IDE.
- Copy the highlighted contents of
this pom.xml file into yours
inside the
<project>
tag.
- Create a new Package
testPackage
undersrc/test/java
- Create a new Java class
TestClass
under your newly createdtestPackage
. - Copy the below imports into your newly created
TestClass
after the line that containspackage testPackage
.
import com.shaft.driver.SHAFT;
import com.shaft.gui.internal.locator.Locator;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
- Copy the below code snippet into the body of your
TestClass
after the line that containspublic class TestClass {
.
SHAFT.GUI.WebDriver driver;
SHAFT.TestData.JSON testData;
String targetUrl = "https://duckduckgo.com/";
By logo = By.xpath("//div[contains(@class,'container_fullWidth__1H_L8')]//img");
By searchBox = Locator.hasAnyTagName().hasAttribute("name", "q").build(); // synonym to By.name("q");
By firstSearchResult = Locator.hasTagName("article").isFirst().build(); // synonym to By.xpath("(//article)[1]");
@Test
public void navigateToDuckDuckGoAndAssertBrowserTitleIsDisplayedCorrectly() {
driver.browser().navigateToURL(targetUrl)
.and().assertThat().title().contains(testData.getTestData("expectedTitle"));
}
@Test
public void navigateToDuckDuckGoAndAssertLogoIsDisplayedCorrectly() {
driver.browser().navigateToURL(targetUrl)
.and().element().assertThat(logo).matchesReferenceImage();
}
@Test
public void searchForQueryAndAssert() {
driver.browser().navigateToURL(targetUrl)
.and().element().type(searchBox, testData.getTestData("searchQuery") + Keys.ENTER)
.and().assertThat(firstSearchResult).text().doesNotEqual(testData.getTestData("unexpectedInFirstResult"));
}
@BeforeClass
public void beforeClass() {
testData = new SHAFT.TestData.JSON("simpleJSON.json");
}
@BeforeMethod
public void beforeMethod() {
driver = new SHAFT.GUI.WebDriver();
}
@AfterMethod
public void afterMethod(){
driver.quit();
}
--TODO--
--TODO--
Tip
In case you are planning to use Cucumber with IntelliJ IDEA, due to a known issue with IntelliJ you need to edit your run configuration template before running your tests by following these steps:
- Open 'Edit Run/Debug Configurations' dialog > Edit Configurations... > Edit configuration templates...
- Select Cucumber Java > Program Arguments > and add this argument:
--plugin com.shaft.listeners.CucumberFeatureListener
- After saving the changes, remember to delete any old runs you may have triggered by mistake before adding the needed config.
- Create the following file
src/test/resources/testDataFiles/simpleJSON.json
. - Copy the below code snippet into your newly created json file.
{
"searchQuery": "SHAFT_Engine",
"expectedTitle": "DuckDuckGo",
"unexpectedInFirstResult": "Nope"
}
- Run your
TestClass.java
either from the side menu or by pressing the run button. - On the first test run:
- SHAFT will create a new folder
src/main/resources/properties
and generate some default properties files. - SHAFT will run in
minimalistic test run
mode and will self-configure its listeners under thesrc/test/resources/META-INF/services
directory.
- SHAFT will create a new folder
Tip
You can visit the user guide ➡️ to learn how to configure all SHAFT's properties.
- On all following test runs:
- After the run is complete, the Allure execution report will open automatically in your default web browser.
- Join our
to get notified by email when a new release is pushed out.
Note
After upgrading your Engine to a new major release it is sometimes recommended to delete the properties
folder src\main\resources\properties
and allow SHAFT to regenerate the defaults by running any test method.
- Check out our comprehensive and friendly user guide to learn why SHAFT should be your solution of choice if you're aiming for successful test automation.
🌍 Our success partners ⤴
|
Trusted solution of choice for: 1
![]() ![]() |
🚀 Features ⤴
- SHAFT provides a lot of out-of-the-box convenience features to facilitate your testing process and eliminate the need for boilerplate code.
- All of SHAFT's smart features target the three pillars of successful test automation:
- Scalability: The ability to run tests on multiple devices and browsers in parallel.
- Reliability: The ability to run tests without flakiness and with detailed reporting.
- Maintainability: The ability to easily maintain and update tests as the application changes.
CI/CD integration | Cloud device farm integration | Headless testing | Parallel execution | Containerized execution |
---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ✅ |
Automated synchronization | Logging | Reporting | Screenshots/Attachments | Video recording |
---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ✅ |
Fluent design | Locator builder | Smart locators | Native WebDriver access |
Element/Browser validations builder | AI-powered visual validations |
---|---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Linux | macOS | Windows | Android | iOS | |
---|---|---|---|---|---|
Google Chrome | ✅ | ✅ | ✅ | ✅ | ✅ |
Microsoft Edge | ✅ | ✅ | ✅ | _ | _ |
Mozilla Firefox | ✅ | ✅ | ✅ | _ | _ |
Apple Safari | _ | ✅ | _ | _ | ✅ |
Android | iOS | Windows | |
---|---|---|---|
Native | ✅ | ✅ | N/A |
Hybrid | ✅ | ✅ | N/A |
Flutter | ✅ | ✅ | N/A |
WPF | N/A | N/A | ✅ |
API | Database | CLI | JSON | YAML | Excel | Property | |
---|---|---|---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
TestNG | JUnit5 | Cucumber |
---|---|---|
✅ | ✅ | ✅ |
👨💻 Tech stack ⤴
|
![]() ![]() |
🤝 Support & contributions ⤴
- Feel free to create PRs directly. This lovely tutorial will help.
- Join us via Slack & Facebook
|
Important
Stop Reinventing the wheel! Start using SHAFT!
![]() |
Footnotes
-
Company names are collected via anonymous surveys and provided freely by engineers who claimed to be using SHAFT_Engine within these companies. ↩