An open API service indexing awesome lists of open source software.

https://github.com/rahulrathore44/modularframework

Framework for Selenium Automation Using Modular Design Pattern
https://github.com/rahulrathore44/modularframework

modular modularity-framework selenium selenium-java selenium-webdriver testng

Last synced: 10 months ago
JSON representation

Framework for Selenium Automation Using Modular Design Pattern

Awesome Lists containing this project

README

          

###Modular Framework

Selenium Modular Framework using Testng. Classes to handle the web components are present and can be used directly in the code.
The framework has following features

1. Modular Design
2. Maven based framework
3. Log4j enabled for logging
4. Report Generation (Excel & Extent reports)
5. Helper class to handle web component such as (Button,Link etc)
6. Centralized Configuration (Using Properties file)
7. POM
8. Support reading the data form Excel and Database.

###Here is the basic code:

Extend your test class from InitWebdriver class.

```java
package com.modular.framework;

import org.testng.Assert;
import org.testng.annotations.Test;

import com.modular.framework.helper.InitWebdriver;
import com.modular.framework.helper.Browser.BrowserHelper;
import com.modular.framework.helper.Javascript.JavaScriptHelper;

/**
* @author rsr
*
* Jul 27, 2016
*/
public class TestBrowserWindow extends InitWebdriver {

@Test
public void testBrowser() {
Driver.get("http://www.gmail.com");
JavaScriptHelper.executeScript("window.open('http://www.w3schools.com', '', 'width=100, height=100');");
BrowserHelper.SwitchToWindow(1);
BrowserHelper.browserMaximize();
Assert.assertNotNull(Driver.getTitle());
BrowserHelper.switchToParentWindow();
Assert.assertNotNull(Driver.getTitle());
BrowserHelper.switchToParentWithChildClose();
Assert.assertNotNull(Driver.getTitle());
}

}

```

### Use the testng.xml file to run the test cases

```xml









```

### To see this whole thing running simply checkout this project and run this command:

`mvn clean generate-sources test`