
Today marks a big milestone in my automation journey π―
Till now, I was learning core Java logic
π Today, I stepped into real automation using Selenium
This is where things get exciting π₯
πΉ 1. What is Selenium?
π Selenium is a tool used for automating web browsers
That means:
- Opening a browser π
- Navigating websites
- Clicking buttons
- Filling forms
- Validating UI
π‘ In simple terms:
π If you can do it manually in a browser, Selenium can automate it.
πΉ 2. Why Selenium?
β Saves time β±
β Reduces manual effort
β Useful for testing & automation
β Industry standard tool
πΉ 3. Setting Up Selenium using Maven
Instead of downloading jars manually, we use Maven π¦
π Maven helps manage:
- Dependencies
- Versions
- Project structure
πΉ 4. Understanding pom.xml File
This is the heart of a Maven project β€οΈ
π» Sample pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>Selenium1</groupId>
<artifactId>Selenium1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.18.1</version>
</dependency>
</dependencies>
</project>
π Explanation (Important π₯)
π§ Project Info:
-
groupIdβ Project/company name -
artifactIdβ Project name -
versionβ Current version
βοΈ Properties:
<maven.compiler.source>17</maven.compiler.source>
π Defines Java version
π¦ Dependencies:
<dependency>
π This is where we add external libraries
πΉ 5. How to Add Dependency from Maven Repository
π Go to: mvnrepository.com
Steps:
- Search β selenium-java
- Select latest version
- Copy dependency
- Paste inside
<dependencies>
π‘ Why this is important?
π Instead of manual setup, Maven automatically:
- Downloads jars
- Manages versions
- Handles conflicts
πΉ 6. Creating Selenium Setup
Once dependency is added β
π Maven will download everything automatically
Now we are ready to write our first automation program π
πΉ 7. First Selenium Program
package first;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class First {
public static void main(String[] args) {
ChromeDriver driver = new ChromeDriver();
driver.get("https://google.com");
}
}
π Logic Explained:
-
ChromeDriverβ launches Chrome browser -
driver.get()β opens website
π Thatβs it! Your first automation script π
β οΈ Important Notes:
β ChromeDriver should match browser version
β Browser will open automatically
β Close using driver.quit()
πΉ8. π Browsers Supported by Selenium
Selenium supports multiple browsers using specific drivers π
β Browser / Driver Mapping
| Browser | Driver |
|---|---|
| Google Chrome | ChromeDriver |
| Mozilla Firefox | GeckoDriver |
| Microsoft Edge | EdgeDriver |
| Safari | SafariDriver |
| Internet Explorer | IEDriverServer |
| Opera | OperaDriver |
| Chromium | ChromeDriver |
| Brave | ChromeDriver |
| Vivaldi | ChromeDriver |
π‘ Key Insight:
π Most modern browsers are Chromium-based
π So they work using ChromeDriver
πΉ9. π» Operating Systems Supported by Selenium
Selenium is cross-platform and works across multiple environments π
β OS / Support Type
| Operating System | Support |
|---|---|
| Windows | Supported |
| macOS | Supported |
| Linux | Supported |
| Unix | Supported |
π§ Extended Environment Support
| Environment | Support |
|---|---|
| Docker | Supported |
| Jenkins (CI/CD) | Supported |
| GitHub Actions | Supported |
| AWS / Azure / GCP | Supported |
π‘ Key Insight:
π Selenium scripts can run on any OS where browser + driver is available
π This enables:
β Cross-browser testing
β Cross-platform automation
β Scalable test execution π
πΉ 10. Real-World Use Cases
π Login automation
π Form submissions
π Testing UI flows
π Web scraping (basic level)
π Final Takeaways
β Selenium = Browser Automation
β Maven = Dependency Management
β pom.xml = Project configuration
β Easy setup using Maven repository
β First step into real automation π
π€ A Small Note
I used ChatGPT to help structure and refine this blog while keeping the concepts aligned with my learning.
Top comments (0)