Project Status: 90%
Just a simple to use, extremely portable, cross-platform, command line operable, java-based, Selenium + testNG framework for web automation testing on the usual suspects of browsers. Tutorial videos to come eventually…
TestExample.java) and write Selenium tests as desired using TestNG for assertions
driver.get("<URL>");
// navigates to desired url
driver.findElement(By.className("button")).click();
// clicks on the warning button
driver.findElement(By.id("username")).sendKeys("example-user");
// finds login text box and types "example-user"
WebElement myInput = driver.findElement(By.cssSelector("input"));
// finds an element based on its CSS selector and copies a reference to a local variable for future interaction with this element
Assert.assertEquals(driver.getTitle(), "Google");
// asserts the web site title is "Google"
Assert.assertEquals(myInput.getAttribute("value"), "4200");
// asserts the myInput value is "4200"
WAFScreenShotter utility class
package util;
new WAFScreenShotter(<WEBDRIVER>, "<PICTURE NAME>");
// takes picture of current page and puts it current directory
.webp is automatically addedWAFScreenShotter object you can simply use the .takeScreenshot() method to take another screenshot
myWAFScreenShotter.takeScreenshot(driver, "example");
// takes picture and places "example.webp" in current directory
WAFFileDownloader utility class
package util;
new WAFFileDownloader(<WEBDRIVER>, "<FOLDER NAME>", "<CSS SELECTOR>");
// downloads all files on current page based on selector into the user specified folder
make clean is runa since you should be clicking links to download filesWAFFileDownloader object you can simply use the .downloadFiles() method to download additional files
myWAFFileDownloader.downloadFiles(driver, "my-Files-Folder", "td > a");
// downloads all files on the page that are table element links
make
make compile
java -cp .:res/* Main <OPTIONAL ARGUMENTS>
javac -cp "res/*;." util/*.java
javac -cp "res/*;." *.java
java -cp "res/*;." Main <OPTIONAL ARGUMENTS>
<OPTIONAL ARGUMENTS> is replaced by your command line arguments
-b or --browser followed by browser name (chrome, firefox, edge, ie) for specific browser
chrome-w or --width followed by port number for specific browser width
1024-h or --height followed by port number for specific browser height
768-p or --port followed by port number to run on a specific port number
0 (web driver will automatically choose ports)-u or --url followed by ip address for specific ip/site to be used
-t or --tag followed by a non-spaced comma-separated value of test class names
Example1, Example2 to run TestExample1 and TestExample2 test classes for exampleExampletest-output will be generated
html exists and within that is the index.html file containing the reportNG report of how the tests wenttestng-results.xml is an xml report that can be used to display results within an environment like Jenkins or Zephyrmake clean
make superclean
build.xml (recreated by Main.java each run) and the pdf copy of this READMEThis framework works in the following manner:
1) All java files are compiled
2) Main is run
1) Parses optional arguments
2) Creates build.xml TestNG
3) Uses build.xml as a template to run tests
1) Initializes web driver
2) Performs actions using Selenium
3) TestNG test assertions are checked
3) TestNG framework creates output .html and .xml files to view test results
make runs the following commands:
javac -cp .:res/* util/*.java
javac -cp .:res/* *.java
java -cp .:res/* Main
make compile runs the following commands:
javac -cp .:res/* util/*.java
javac -cp .:res/* *.java
make clean runs the following command:
rm -rf test-output *Files* *.class util/*.class *.zip *.webp *.jpg
make superclean runs the following command:
rm -rf test-output *Files* *.class util/*.class *.zip *.webp *.jpg *.pdf docs/*.pdf *.xml
5.1-7.1 would run every test that exists in that range5.1.1 would run just that specific step (wrapped in login and quit)smoke would run just tests labeled with smokenot debug would run all tests that aren’t debugkillall chromedriver or killall geckodriverdrivers folder