Skip to content

lkumarra/Selenium.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Codacy Badge

πŸ§ͺ Selenium.NET β€” Page Object Model Framework

A robust, scalable Selenium test automation framework built with C# / .NET 9 implementing the Page Object Design Pattern (POM). This framework automates the Guru99 Bank Demo Application and serves as a production-ready template for web UI test automation.


πŸ“ Architecture Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          SeleniumPOM Solution                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  TestCase/   │───▢│ TestContext/  │───▢│       Pages/               β”‚  β”‚
β”‚  β”‚             β”‚    β”‚              β”‚    β”‚                            β”‚  β”‚
β”‚  β”‚ LoginTest   β”‚    β”‚ TestClass    β”‚    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚  β”‚ HomeTest    β”‚    β”‚ Context      β”‚    β”‚  β”‚Actions/β”‚  β”‚Locators/β”‚  β”‚  β”‚
β”‚  β”‚ NewCustomer β”‚    β”‚              β”‚    β”‚  β”‚        β”‚  β”‚         β”‚  β”‚  β”‚
β”‚  β”‚ EditCustomerβ”‚    β”‚ β€’ ExtentRpt  β”‚    β”‚  β”‚LoginPg β”‚  β”‚LoginLoc β”‚  β”‚  β”‚
β”‚  β”‚ DeleteCust  β”‚    β”‚ β€’ SetUp/     β”‚    β”‚  β”‚HomePg  β”‚  β”‚HomeLoc  β”‚  β”‚  β”‚
β”‚  β”‚ NewAccount  β”‚    β”‚   TearDown   β”‚    β”‚  β”‚NewCust β”‚  β”‚NewCustL β”‚  β”‚  β”‚
β”‚  β”‚ EditAccount β”‚    β”‚              β”‚    β”‚  β”‚EditCustβ”‚  β”‚EditCustLβ”‚  β”‚  β”‚
β”‚  β”‚ DeleteAcct  β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  β”‚DeleteCuβ”‚  β”‚DelCustL β”‚  β”‚  β”‚
β”‚  β”‚ Deposit     β”‚                        β”‚  β”‚NewAcct β”‚  β”‚NewAcctL β”‚  β”‚  β”‚
β”‚  β”‚ Withdrawal  β”‚                        β”‚  β”‚EditAcctβ”‚  β”‚EditAcctLβ”‚  β”‚  β”‚
β”‚  β”‚ FundTransferβ”‚                        β”‚  β”‚DelAcct β”‚  β”‚DelAcctL β”‚  β”‚  β”‚
β”‚  β”‚ BalanceEnq  β”‚                        β”‚  β”‚Deposit β”‚  β”‚DepositL β”‚  β”‚  β”‚
β”‚  β”‚ MiniStmt    β”‚                        β”‚  β”‚Withdrawβ”‚  β”‚WithdrawLβ”‚  β”‚  β”‚
β”‚  β”‚ CustomStmt  β”‚                        β”‚  β”‚FundTrfrβ”‚  β”‚FundTrfrLβ”‚  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β”‚  β”‚BalEnq  β”‚  β”‚BalEnqL  β”‚  β”‚  β”‚
β”‚                                         β”‚  β”‚MiniStmtβ”‚  β”‚MiniStmtLβ”‚  β”‚  β”‚
β”‚                                         β”‚  β”‚CustStmtβ”‚  β”‚CustStmtLβ”‚  β”‚  β”‚
β”‚                                         β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚                                         β”‚                            β”‚  β”‚
β”‚                                         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚  β”‚
β”‚                                         β”‚  β”‚    BasePage/       β”‚    β”‚  β”‚
β”‚                                         β”‚  β”‚    Page.cs         β”‚    β”‚  β”‚
β”‚                                         β”‚  β”‚  β€’ WebDriver Init  β”‚    β”‚  β”‚
β”‚                                         β”‚  β”‚  β€’ Browser Setup   β”‚    β”‚  β”‚
β”‚                                         β”‚  β”‚  β€’ Session Mgmt    β”‚    β”‚  β”‚
β”‚                                         β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  β”‚
β”‚                                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Interfaces/  β”‚  β”‚  Utilities/  β”‚  β”‚   Config/    β”‚  β”‚  Setting/  β”‚  β”‚
β”‚  β”‚              β”‚  β”‚              β”‚  β”‚              β”‚  β”‚            β”‚  β”‚
β”‚  β”‚ ILoginPage   β”‚  β”‚ Utils.cs     β”‚  β”‚ AppConfig    β”‚  β”‚ AppConfig  β”‚  β”‚
β”‚  β”‚ IHomePage    β”‚  β”‚ ExtentRpt    β”‚  β”‚ Reader.cs    β”‚  β”‚ Keys.cs    β”‚  β”‚
β”‚  β”‚ INewCustPg   β”‚  β”‚ Helper.cs    β”‚  β”‚ Constants.cs β”‚  β”‚ ObjectRepo β”‚  β”‚
β”‚  β”‚ IEditCustPg  β”‚  β”‚ Log4Net      β”‚  β”‚ appsettings  β”‚  β”‚ sitory.cs  β”‚  β”‚
β”‚  β”‚ IDeleteCust  β”‚  β”‚ Helper.cs    β”‚  β”‚ .json        β”‚  β”‚            β”‚  β”‚
β”‚  β”‚ INewAcctPg   β”‚  β”‚ MailUtil.cs  β”‚  β”‚ extent-      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”‚ IEditAcctPg  β”‚  β”‚              β”‚  β”‚ config.xml   β”‚                   β”‚
β”‚  β”‚ IDeleteAcct  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚  β”‚ IDepositPg   β”‚                                                       β”‚
β”‚  β”‚ IWithdrawal  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ IFundTransfr β”‚  β”‚ CustomExcep/ β”‚  β”‚  TestData/   β”‚  β”‚TestReports/β”‚  β”‚
β”‚  β”‚ IBalanceEnq  β”‚  β”‚              β”‚  β”‚              β”‚  β”‚            β”‚  β”‚
β”‚  β”‚ IMiniStmt    β”‚  β”‚ NoSuitable   β”‚  β”‚ Guru99Bank   β”‚  β”‚ extent     β”‚  β”‚
β”‚  β”‚ ICustStmt    β”‚  β”‚ DriverFound  β”‚  β”‚ .xlsx        β”‚  β”‚ .html      β”‚  β”‚
β”‚  β”‚ IConfig      β”‚  β”‚ .cs          β”‚  β”‚              β”‚  β”‚            β”‚  β”‚
β”‚  β”‚ IUtil        β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                                       β”‚
β”‚                                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”„ Test Execution Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MSTest   │────▢│ TestClass    │────▢│  Page.cs     │────▢│ WebDriverβ”‚
β”‚  Runner   β”‚     β”‚ Context      β”‚     β”‚ (BasePage)   β”‚     β”‚ Manager  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                        β”‚                     β”‚                   β”‚
                        β–Ό                     β–Ό                   β–Ό
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚  Test Case   β”‚     β”‚ Action Page  β”‚     β”‚ Chrome / β”‚
                 β”‚  (e.g.       │────▢│ (e.g.        │────▢│ Firefox  β”‚
                 β”‚  LoginTest)  β”‚     β”‚  LoginPage)  β”‚     β”‚ Browser  β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                             β”‚
                                             β–Ό
                                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                      β”‚  Locator     β”‚
                                      β”‚  (e.g.       β”‚
                                      β”‚  LoginPage   β”‚
                                      β”‚  Locators)   β”‚
                                      β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                                             β”‚
                                             β–Ό
                                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                      β”‚  Utils.cs    β”‚
                                      β”‚  β€’ Click     β”‚
                                      β”‚  β€’ SendKeys  β”‚
                                      β”‚  β€’ Wait      β”‚
                                      β”‚  β€’ JS Exec   β”‚
                                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Technology Stack

Component Library Version
Runtime .NET 9.0
Browser Automation Selenium WebDriver 4.29.0
Browser Support Selenium Support 4.29.0
Page Objects DotNetSeleniumExtras.PageObjects.Core 4.14.1
Wait Helpers DotNetSeleniumExtras.WaitHelpers 3.11.0
Driver Management WebDriverManager 2.17.5
Test Framework MSTest (TestAdapter + Framework) 3.7.3
Test SDK Microsoft.NET.Test.Sdk 17.12.0
Reporting ExtentReports 5.0.4
Logging log4net 3.0.4
Configuration Microsoft.Extensions.Configuration 9.0.4
JSON Handling Newtonsoft.Json 13.0.3
Database MongoDB.Driver 3.3.0

πŸ“ Project Structure

SeleniumPOM/
β”œβ”€β”€ appsettings.json                    # Application configuration (browser, URL, credentials)
β”œβ”€β”€ SeleniumPOM.csproj                  # SDK-style project file targeting .NET 9
β”‚
β”œβ”€β”€ Config/                             # Configuration layer
β”‚   β”œβ”€β”€ AppConfigReader.cs              # Reads settings from appsettings.json
β”‚   β”œβ”€β”€ Constants.cs                    # Application-wide constants (email, report paths)
β”‚   └── extent-config.xml              # ExtentReports XML configuration
β”‚
β”œβ”€β”€ CustomException/                    # Custom exception classes
β”‚   └── NoSuitableDriverFound.cs       # Thrown when browser config is invalid
β”‚
β”œβ”€β”€ Interfaces/                         # Interface contracts for all pages
β”‚   β”œβ”€β”€ IConfig.cs                     # Configuration reader interface
β”‚   β”œβ”€β”€ IUtil.cs                       # Utility operations interface
β”‚   β”œβ”€β”€ ILoginPage.cs                  # Login page operations
β”‚   β”œβ”€β”€ IHomePage.cs                   # Home page navigation
β”‚   β”œβ”€β”€ INewCostumerPage.cs            # New customer form operations
β”‚   β”œβ”€β”€ IEditCostumerPage.cs           # Edit customer operations
β”‚   β”œβ”€β”€ IDeleteCustomerPage.cs         # Delete customer operations
β”‚   β”œβ”€β”€ INewAccountPage.cs             # New account operations
β”‚   β”œβ”€β”€ IEditAccountPage.cs            # Edit account operations
β”‚   β”œβ”€β”€ IDeleteAccountPage.cs          # Delete account operations
β”‚   β”œβ”€β”€ IDepositPage.cs                # Deposit operations
β”‚   β”œβ”€β”€ IWithdrawalPage.cs             # Withdrawal operations
β”‚   β”œβ”€β”€ IFundTransferPage.cs           # Fund transfer operations
β”‚   β”œβ”€β”€ IBalanceEnquiryPage.cs         # Balance enquiry operations
β”‚   β”œβ”€β”€ IMiniStatementPage.cs          # Mini statement operations
β”‚   └── ICustomisedStatementPage.cs    # Customised statement operations
β”‚
β”œβ”€β”€ Pages/                              # Page Object Model implementation
β”‚   β”œβ”€β”€ BasePage/
β”‚   β”‚   └── Page.cs                    # Base class: WebDriver init, browser setup, teardown
β”‚   β”œβ”€β”€ Locators/                      # Element locators using @FindsBy annotations
β”‚   β”‚   β”œβ”€β”€ LoginPageLocators.cs
β”‚   β”‚   β”œβ”€β”€ HomePageLocator.cs
β”‚   β”‚   β”œβ”€β”€ NewCustomerLocators.cs
β”‚   β”‚   β”œβ”€β”€ EditCostumerLocator.cs
β”‚   β”‚   β”œβ”€β”€ DeleteCustomerLocator.cs
β”‚   β”‚   β”œβ”€β”€ NewAccountLocator.cs
β”‚   β”‚   β”œβ”€β”€ EditAccountLocator.cs
β”‚   β”‚   β”œβ”€β”€ DeleteAccountLocator.cs
β”‚   β”‚   β”œβ”€β”€ DepositLocator.cs
β”‚   β”‚   β”œβ”€β”€ WithdrawalLocator.cs
β”‚   β”‚   β”œβ”€β”€ FundTrasferLocator.cs
β”‚   β”‚   β”œβ”€β”€ BalanceEnquiryLocator.cs
β”‚   β”‚   β”œβ”€β”€ MiniStatementLocator.cs
β”‚   β”‚   └── CustomisedStatementLocator.cs
β”‚   └── Actions/                       # Page action methods (business logic)
β”‚       β”œβ”€β”€ LoginPage.cs
β”‚       β”œβ”€β”€ HomePage.cs
β”‚       β”œβ”€β”€ NewCustomerPage.cs
β”‚       β”œβ”€β”€ EditCustomerPage.cs
β”‚       β”œβ”€β”€ DeleteCustomerPage.cs
β”‚       β”œβ”€β”€ NewAccountPage.cs
β”‚       β”œβ”€β”€ EditAccountPage.cs
β”‚       β”œβ”€β”€ DeleteAccountPage.cs
β”‚       β”œβ”€β”€ DepositPage.cs
β”‚       β”œβ”€β”€ WithdrawalPage.cs
β”‚       β”œβ”€β”€ FundTrasferPage.cs
β”‚       β”œβ”€β”€ BalanceEnquiryPage.cs
β”‚       β”œβ”€β”€ MiniStatementPage.cs
β”‚       └── CustomisedStatementPage.cs
β”‚
β”œβ”€β”€ Setting/                            # Application settings
β”‚   β”œβ”€β”€ AppConfigKeys.cs               # Configuration key constants
β”‚   └── ObjectRepsitory.cs             # Static config object holder
β”‚
β”œβ”€β”€ TestCase/                           # MSTest test classes
β”‚   β”œβ”€β”€ LoginTest.cs
β”‚   β”œβ”€β”€ HomeTest.cs
β”‚   β”œβ”€β”€ NewCustomerTest.cs
β”‚   β”œβ”€β”€ EditCustomerTest.cs
β”‚   β”œβ”€β”€ DeleteCustomerTest.cs
β”‚   β”œβ”€β”€ NewAccountTest.cs
β”‚   β”œβ”€β”€ EditAccountTest.cs
β”‚   β”œβ”€β”€ DeleteAccountTest.cs
β”‚   β”œβ”€β”€ DepositTest.cs
β”‚   β”œβ”€β”€ WithdrawalTest.cs
β”‚   β”œβ”€β”€ FundTransferTest.cs
β”‚   β”œβ”€β”€ BalanceEnquiryTest.cs
β”‚   β”œβ”€β”€ MiniStatementTest.cs
β”‚   β”œβ”€β”€ CustomisedStatementTest.cs
β”‚   └── UnitTest1.cs
β”‚
β”œβ”€β”€ TestContextClass/                   # Test lifecycle management
β”‚   └── TestClassContext.cs            # Assembly init/cleanup, ExtentReports setup
β”‚
β”œβ”€β”€ Utilities/                          # Helper utilities
β”‚   β”œβ”€β”€ Utils.cs                       # WebElement interactions (click, type, wait, JS)
β”‚   β”œβ”€β”€ ExtentReportsHelper.cs         # ExtentReports 5.x Spark reporter wrapper
β”‚   β”œβ”€β”€ Log4NetHelper.cs               # log4net programmatic configuration
β”‚   └── MailUtil.cs                    # Email report sender via SMTP
β”‚
β”œβ”€β”€ TestData/                           # Test data files
β”‚   └── Guru99Bank.xlsx                # Excel test data
β”‚
β”œβ”€β”€ TestReports/                        # Generated HTML test reports
β”‚   └── extent.html
β”‚
└── Logs/                               # Generated log files
    β”œβ”€β”€ FileLogger.log
    └── RollingFileLogger.log

πŸ—οΈ Design Patterns & Principles

Page Object Model (POM)

Each web page is represented by two classes:

  • Locator class β€” Defines element locators using [FindsBy] attributes with PageFactory
  • Action class β€” Implements business logic methods that interact with elements

Interface Segregation

Every page has a corresponding interface (e.g., ILoginPage), enabling:

  • Loose coupling between test cases and page implementations
  • Easy mocking for unit testing
  • Clear API contracts

Base Page Pattern

Page.cs serves as the base class providing:

  • WebDriver initialization with WebDriverManager (auto-downloads correct driver)
  • Browser configuration (Chrome/Firefox)
  • Session management (cookies, timeouts, window maximization)

Utility Abstraction

Utils.cs wraps common Selenium operations with built-in explicit waits:

  • ClickOnElement() β€” Wait + Click
  • EnterTextIntoElement() β€” Wait + SendKeys
  • GetElementText() β€” Wait + Get Text
  • SelectByVisibleText() β€” Dropdown selection
  • JSExecutor() / JSExecutorClick() β€” JavaScript execution
  • GetAlertTextAndAccept() β€” Alert handling

πŸ”€ Layer Interaction Diagram

  Test Layer          Page Layer              Utility Layer         Driver Layer
  ──────────          ──────────              ─────────────         ────────────
       β”‚                   β”‚                       β”‚                     β”‚
       β”‚  Login(user,pwd)  β”‚                       β”‚                     β”‚
       │──────────────────▢│                       β”‚                     β”‚
       β”‚                   β”‚  EnterText(element)   β”‚                     β”‚
       β”‚                   │──────────────────────▢│                     β”‚
       β”‚                   β”‚                       β”‚  FindElement()      β”‚
       β”‚                   β”‚                       │────────────────────▢│
       β”‚                   β”‚                       β”‚  SendKeys()         β”‚
       β”‚                   β”‚                       │────────────────────▢│
       β”‚                   β”‚                       │◀────────────────────│
       β”‚                   │◀──────────────────────│                     β”‚
       β”‚                   β”‚  Click(loginBtn)      β”‚                     β”‚
       β”‚                   │──────────────────────▢│                     β”‚
       β”‚                   β”‚                       β”‚  Click()            β”‚
       β”‚                   β”‚                       │────────────────────▢│
       β”‚                   β”‚                       │◀────────────────────│
       β”‚                   │◀──────────────────────│                     β”‚
       β”‚  return HomePage  β”‚                       β”‚                     β”‚
       │◀──────────────────│                       β”‚                     β”‚
       β”‚                   β”‚                       β”‚                     β”‚

πŸš€ Getting Started

Prerequisites

  • .NET 9 SDK installed
  • Chrome or Firefox browser installed

Quick Start

# Clone the repository
git clone https://github.com/lkumarra/Selenium.NET.git
cd Selenium.NET

# Restore NuGet packages
dotnet restore

# Build the project
dotnet build

# Run all tests
dotnet test

# Run tests with detailed output
dotnet test --logger "console;verbosity=detailed"

# Run a specific test
dotnet test --filter "VerifyLogin"

Using Visual Studio / VS Code

  1. Open SeleniumPOM.sln
  2. Build the solution (Ctrl+Shift+B)
  3. Open Test Explorer (Ctrl+E, T)
  4. Run individual tests or all tests

βš™οΈ Configuration

Application settings are in SeleniumPOM/appsettings.json:

{
  "AppSettings": {
    "Browser": "Chrome",
    "UserName": "your_username",
    "Password": "your_password",
    "Url": "http://www.demo.guru99.com/V4/index.php"
  }
}
Key Description Values
Browser Browser to use for testing Chrome, Firefox
UserName Login username Any valid username
Password Login password Corresponding password
Url Application URL Target web application URL

πŸ“Š Reporting

ExtentReports (HTML)

  • Reports are auto-generated at TestReports/extent.html
  • Uses ExtentSparkReporter (ExtentReports 5.x)
  • Includes system info, test status (Pass/Fail/Skip), and screenshots

log4net Logging

  • Console Appender β€” Real-time output during test execution
  • File Appender β€” Logs/FileLogger.log
  • Rolling File Appender β€” Logs/RollingFileLogger.log (max 15 backups)

Email Reports

To enable email reports after test execution:

  1. Fill in email details in Config/Constants.cs
  2. Uncomment MailUtil.SendAttachedReport() in TestContextClass/TestClassContext.cs

πŸ“¦ Migration Summary (v1 β†’ v2)

Aspect Before (v1) After (v2)
Framework .NET Framework 4.7.2 .NET 9.0
Project Format Legacy .csproj + packages.config SDK-style .csproj
Selenium 3.141.0 4.29.0
PageFactory OpenQA.Selenium.Support.PageObjects DotNetSeleniumExtras.PageObjects.Core
ExpectedConditions OpenQA.Selenium.Support.UI SeleniumExtras.WaitHelpers
Configuration App.config + ConfigurationManager appsettings.json + IConfiguration
Reporting ExtentReports 3.x (ExtentHtmlReporter) ExtentReports 5.x (ExtentSparkReporter)
Test Framework MSTest 2.1.1 MSTest 3.7.3
Driver Management Manual driver binaries WebDriverManager 2.17.5 (auto-download)

πŸ“„ License

This project is open source. See the license file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors