This project is a Selenium + TestNG automation framework built with Java that performs product search, price extraction, and add-to-cart validation on Amazon India.
It automates real-world eCommerce scenarios and can run locally or on cloud platforms like LambdaTest.
✅ Open Amazon India website
✅ Search products like iPhone, Samsung Galaxy, Wireless Mouse, etc.
✅ Extract product price
✅ Attempt Add to Cart
✅ Handle basic CAPTCHA detection
✅ Execute tests using TestNG
✅ Supports cloud execution using LambdaTest
| Technology | Version |
|---|---|
| Java | 21 |
| Selenium WebDriver | 4.43.0 |
| TestNG | 7.12.0 |
| Maven | Latest |
| WebDriverManager | Latest |
amazonautomation/
│── src/
│ └── test/
│ └── java/
│ └── tests/
│ └── AmazonTest.java
│── pom.xml
│── testng.xml
│── mvnw
│── mvnw.cmd
│── README.md
git clone https://github.com/GiriGourav/Amazon-Selenium-Automation-Project.git
cd Amazon-Selenium-Automation-ProjectMake sure the following are installed:
- Java 21
- Maven
Check installed versions:
java -version
mvn -versionmvn clean test- Open project in IntelliJ IDEA
- Locate
testng.xml - Right Click → Run
Before running tests on LambdaTest, update your credentials inside the code:
String username = "YOUR_USERNAME";
String accessKey = "YOUR_ACCESS_KEY";You can get these credentials from your LambdaTest dashboard.
After updating credentials, execute the tests normally using Maven or TestNG.
| Test Name | Product |
|---|---|
| iphoneTest | iPhone |
| galaxyTest | Samsung Galaxy |
| wirelessMouseTest | Wireless Mouse |
iphone Price: ₹1,34,900
iphone Add to cart unavailable
Samsung Galaxy Price: ₹1,30,999
Samsung Galaxy Add to cart unavailable
wireless Mouse Price: ₹399
wireless Mouse added to cart
Total tests run: 3
Passes: 3
Failures: 0
Amazon may disable Add to Cart for:
- Sponsored products
- Out of stock items
- Region restricted products
Amazon may detect automation traffic.
- Reduce repeated executions
- Add delays
- Use cloud execution (LambdaTest)
- Run tests less aggressively
Amazon frequently updates UI selectors.
- Update CSS/XPath selectors
- Use explicit waits
- Improve locator strategy
If cloud execution fails:
- Recheck Username
- Recheck Access Key
- Ensure credentials are active
- Page Object Model (POM)
- Screenshot on Failure
- Extent Reports
- Parallel Execution
- Jenkins CI/CD Integration
- Data Driven Testing
Gourav Giri
GitHub: https://github.com/GiriGourav
Successfully executed Selenium TestNG tests on LambdaTest Cloud Grid