Selenium project to perform cross-browser test of DOM Elements of the site Art of Testing using TestNG and Maven.
Selenium IDE Demo: https://www.youtube.com/watch?v=uk01c8UST4g
Selenium Demo: https://www.youtube.com/watch?v=sryHxDWeVfA
This project requires the following to execute:
- Eclipse (with TestNG Plugin)
- Maven 3.9.5
- Java 21
To install the project, perform the following steps:
- Go to Repository.
- Click on Code -> Download as Zip.
- Unzip the file.
- Open Eclipse.
- Click on
File -> Import -> Existing Projects into Workspace
. - In the new Dialog Box, select "Select Root Directory".
- Click on Browse and set the root as the unzipped directory.
- Make sure that the project is selected under "Projects" list.
- Click Finish.
To execute the project, perform the following steps:
- Open Eclipse and make sure the project is active.
- Click on
Run -> Run Configurations...
. - Select TestNG and then either right click and select "New Configuration" or click on the button "New Launch Configuration" located above the search bar.
- On the newly opened dialog on the right-hand side, give the config a "Name".
- Under the "Test" tab, select the "Project" using the "Browse" button.
- Under "Run...", select "Suite" and set it to "TestNGSuite.xml" provided with the project using "Browse".
- Click Apply.
- Click Run.
To execute the project anytime, just go to Run -> Run Configurations... -> (Your new Test Config) -> Run
.
Drag and Drop Test is extremely hard to implement on Gecko (Mozilla Firefox) & Chrome Drivers, as per the following posts and several others like it:
- element is dragged correctly but not dropped at the specified target instead, displayed with the mouse pointer #7744
- Actions class methods for dragging and dropping does not work #7782
- Unable to perform drag and drop with Selenium (python) #8003
There is however a roundabout solution, by using an external javascript file druska/native_js_drag_and_drop_helper.js . This is however not a reliable solution and may need to be modified based on framework used to build the site.
Another solution is to use the Selenium IDE addon/plugin for the web browser for these kind of tests.