<file_sep>package com.accenture.tests;

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

public class MyTest {
  @Test
  public void loginTest() {
	  boolean ER = true;
	  boolean AR = true;
	  Assert.assertEquals(ER, AR);
  }
  @Test
  public void RegTest() {
	  boolean ER = true;
	  boolean AR = false;
	  Assert.assertEquals(ER, AR);
  }
}
<file_sep>package com.accenture.test;

import org.testng.annotations.Test;

import java.io.FileInputStream;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;

public class DataDrivenExcel {
	WebDriver d;
  @Test
  public void DataExcel() throws IOException {
	  System.out.println("hre");
	  d.get("http://demowebshop.tricentis.com/");
	  FileInputStream fin = new FileInputStream("C:\\Users\\pdc2b-training.pdc2b\\Documents\\TestData.xlsx");
	  HSSFWorkbook H = new HSSFWorkbook(fin);
	  HSSFSheet s = H.getSheet("Sheet1");
	  int rowCount= s.getLastRowNum();
	  for (int i = 1; i<=rowCount; i++)
	  {
	  String Username = s.getRow(i).getCell(0).getStringCellValue();
	  System.out.println(Username);
	  String Password = s.getRow(i).getCell(1).getStringCellValue();
	  System.out.println(Password);
	  LoginTest(Username, Password);
	  }
	  try
	  {
		  d.findElement(By.linkText("Log out")).click();
	  }
	  catch (Exception e)
	  {  
	  }
  }
  
  public void LoginTest(String u, String p)
  {
	  d.findElement(By.linkText("Log in")).click();
	  d.findElement(By.id("Email")).sendKeys(u);
	  d.findElement(By.id("Password")).sendKeys(p);
  }
  
  @BeforeTest
  public void BeforeTest() {
	  System.setProperty("webdriver.chrome.driver","C:\\Users\\pdc2b-training.pdc2b\\Desktop\\New folder (2)\\Drivers\\chromedriver_win32\\chromedriver.exe");
	  d = new ChromeDriver();
  }
  
}
<file_sep>package com.accenture.test;

import org.testng.annotations.Test;

import com.gargoylesoftware.htmlunit.javascript.host.Set;
import com.gargoylesoftware.htmlunit.javascript.host.URL;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.openqa.selenium.By;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.Keys;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeTest;

@Test
public class NewTest {
	WebDriver d;
	/*public void demo() {
	  d.get("http://demowebshop.tricentis.com/");
		Actions a = new Actions(d);
		//a.contextClick().build.perform();
		d.findElement(By.linkText("Log in")).click();
		WebElement email = d.findElement(By.id("Email"));
		a.moveToElement(email).keyDown(email, Keys.SHIFT).sendKeys("myname").build().perform();
  }
 	******************************************************** 
  public void demoRobot() throws AWTException, InterruptedException
  {
	Robot r = new Robot();
	//r.keyPress(KeyEvent.VK_WINDOWS);
	//r.keyRelease(KeyEvent.VK_WINDOWS);
	setClipboardData("C:\\Users\\pdc2b-training.pdc2b\\Documents\\abcdefgh.txt");
	Thread.sleep(1000);
	r.keyPress(KeyEvent.VK_CONTROL);
	r.keyPress(KeyEvent.VK_V);
	r.keyRelease(KeyEvent.VK_CONTROL);
	r.keyRelease(KeyEvent.VK_V);
  }
 	********************************************************
  public void setClipboardData (String s)
  {
	  StringSelection s1 = new StringSelection(s);
	  Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s1, null);
  }
	********************************************************
public class TakeScreenshot {
	WebDriver d;
public void screenshot() throws IOException{
	d.get("http://demowebshop.tricentis.com/");
	TakeScreenshot t = (TakeScreenShot)d;
	File f = t.getScreenshotAs(OutputType.FILE);
	FileUtils.copyFile(f, File("C:\\Screenshots\\myscreenshot.jpg"));
}

	********************************************************
public class Javascript{
	public void js() throws IOException{
		d.get("http://demowebshop.tricentis.com/");
		d.manage().window().maximize();
		JavascriptExecutor j = (JavascriptExecutor) d;
		
	}
	********************************************************
public class Cookies {
	WebDriver d;
	
	@Test
	public void demo() throws IOException{
		d.get("http://demowebshop.tricentis.com/");
		d.manage().deleteAllCookies();
		Cookie c = new Cookie("User", "Tricentis");
		d.manage().addCookie(c);
		Set<Cookie> cookiesDetails = d.manage().getCookies();
		for (Cookie s:cookiesDetails)
		{
			System.out.println(s.getExpiry());
			System.out.println(s.getName());
			System.out.println(s.getDomain());
		}
	}	
	********************************************************
	public class SeleniumGrid {
  @Test
  public void setup() {
	  DesiredCapabilities dc = new DesiredCapabilities();
	  dc.setBrowserName("chrome");
	  dc.setPlatform(Platform.WINDOWS);
	  RemoteWebDriver d = new RemoteWebDriver(new URL ("http://10.243.204.8:4343/wd/hub"), dc);
  }
  ****************************************************************
  public class DataDrivenExcel {
	WebDriver d;
  @Test
  public void DataExcel() throws IOException {
	  System.out.println("hre");
	  d.get("http://demowebshop.tricentis.com/");
	  FileInputStream fin = new FileInputStream("C:\\Users\\pdc2b-training.pdc2b\\Documents\\TestData.xlsx");
	  HSSFWorkbook H = new HSSFWorkbook(fin);
	  HSSFSheet s = H.getSheet("Sheet1");
	  int rowCount= s.getLastRowNum();
	  for (int i = 1; i<=rowCount; i++)
	  {
	  String Username = s.getRow(i).getCell(0).getStringCellValue();
	  System.out.println(Username);
	  String Password = s.getRow(i).getCell(1).getStringCellValue();
	  System.out.println(Password);
	  LoginTest(Username, Password);
	  }
	  try
	  {
		  d.findElement(By.linkText("Log out")).click();
	  }
	  catch (Exception e)
	  {  
	  }
  }
  
  public void LoginTest(String u, String p)
  {
	  d.findElement(By.linkText("Log in")).click();
	  d.findElement(By.id("Email")).sendKeys(u);
	  d.findElement(By.id("Password")).sendKeys(p);
  }*/

  @BeforeTest
  public void BeforeTest() {
	  System.setProperty("webdriver.chrome.driver","C:\\Users\\pdc2b-training.pdc2b\\Desktop\\New folder (2)\\Drivers\\chromedriver_win32\\chromedriver.exe");
	  d = new ChromeDriver();
  }
}

<file_sep>package com.accenture.test;

import org.testng.annotations.Test;

import com.gargoylesoftware.htmlunit.javascript.host.URL;

import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeTest;


public class SeleniumGrid {
  @Test
  public void setup() {
	  DesiredCapabilities dc = new DesiredCapabilities();
	  dc.setBrowserName("chrome");
	  dc.setPlatform(Platform.WINDOWS);
	  RemoteWebDriver d = new RemoteWebDriver(new URL ("http://10.243.204.8:4343/wd/hub"), dc);
  }
}
