<repo_name>lfmoreno67/SeleniumWebDriver<file_sep>/com.prueba.webdriver/src/test/java/com/prueba/webdriver/Object.java
package com.prueba.webdriver;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class Object {

	private static WebDriver driver;
	String path="./src/test/resources/Drivers/chromedriver.exe";
	
	
	
	public Object(WebDriver driver) {
		super();
		this.driver = driver;
	}

	public WebDriver chromeinicio () {
		
		ChromeOptions opt = new ChromeOptions();
		opt.addArguments("--disable-notifications");
		System.setProperty("webdriver.chrome.driver", path);
		driver = new ChromeDriver(opt);
		driver.manage().window().maximize();
		return driver;
	}
	
	public void visit(String url) {
		driver.get(url);
	}
	
	public void escribir(String mensaje,By  locator) {
		driver.findElement(locator).sendKeys(mensaje);
	}
	
	public void clic(By locator) {
		driver.findElement(locator).click();
	}
	
	public void submit(By locator) {
		driver.findElement(locator).submit();
	}
	
	public String estaEnPantalla(By locator) {
			return driver.getTitle();

	}
}
<file_sep>/com.prueba.webdriver/src/test/java/com/prueba/webdriver/LoginTest.java
package com.prueba.webdriver;

import org.openqa.selenium.WebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class LoginTest {

	private WebDriver driver;
	Page pag = new Page(driver);

	@BeforeTest
	  public void setup() {
		pag = new Page(driver);
		driver = pag.chromeinicio();
		pag.visit("https://www.google.com");
	  }
	
	 @Test(priority=1)
	  public void Login() throws Exception {
		pag.iniciarSesion();
	  }
}
