Quaatso Education

Home Forums Selenium Forum Not able to open the url while using chrome driver Reply To: Not able to open the url while using chrome driver

Reply To: Not able to open the url while using chrome driver

Home Forums Selenium Forum Not able to open the url while using chrome driver Reply To: Not able to open the url while using chrome driver

#4052
Profile photo of Shobhna Garg
Shobhna Garg
Participant

package testCode;

 

import java.io.File;

import java.io.IOException;

import java.util.concurrent.TimeUnit;

 

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.testng.annotations.AfterClass;

import org.testng.annotations.BeforeClass;

import org.testng.annotations.BeforeMethod;

import org.testng.annotations.DataProvider;

import org.testng.annotations.Test;

 

import testData.CsvTestData;

 

public class LoginTest {

 

WebDriver driver ;

 

@BeforeClass

public void init()

{

File f = new File(“D:\\chromedriver.exe”);

System.setProperty(“webdriver.chrome.driver”,f.getAbsolutePath());

driver = new ChromeDriver();

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

driver.manage().window().maximize();

}

 

@BeforeMethod

public void openUrl()

{

driver.get(“https://www.facebook.com/”);

 

 

}

 

@Test (dataProvider = “getCsvData”)

public void verifyLogin(String userName, String password)

{

driver.findElement(By.id(“email”)).sendKeys(userName);

driver.findElement(By.id(“pass”)).sendKeys(password);

driver.findElement(By.id(“loginbutton”)).click();

}

 

 

@AfterClass

public void tearDown()

{

driver.quit();

}

@DataProvider

public Object[][] getCsvData() throws IOException

{

Object[][] data = CsvTestData.getCsvData();

return data;

}

}