1
When using the ratings @Before
and @After
, is giving nullpointer error.
Does anyone know what it is?
Follows the code:
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class TesteAmericanas {
private WebDriver driver;
@Before
public void inicializa() {
System.setProperty("webdriver.chrome.driver", "/Users/Frederico/Cursos/Selenium WebDriver/chromedriver_win32/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
WebDriver driver = new ChromeDriver(options);
driver.manage().window().setSize(new Dimension(1280,720));
driver.get("https://www.americanas.com.br/");
}
@After
public void finaliza() {
driver.close();
}
@Test
public void verificaTituloDaPaginaInicial() {
Assert.assertEquals("Americanas.com - A maior loja. Os menores preços.", driver.getTitle());
}
}