public class IbiboTest {
static WebDriver driver;
@BeforeClass
public void setUp() throws InterruptedException{
System.setProperty("webdriver.chrome.driver","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
//driver= new FirefoxDriver();
driver.get("https://www.goibibo.com/");
Thread.sleep(5000);
driver.manage().window().maximize();
}
@Test
public void testIbiboHomePage(){
IbiboHomePage home = PageFactory.initElements(driver, com.Nalini.Ibibo.IbiboHomePage.class);
home.clickRoundTripRadioButton();
}
public class IbiboHomePage {
WebDriver driver;
@FindBy(css = "input[id='gi_roundtrip_label']")
WebElement iRoundTrip;
public IbiboHomePage(WebDriver driver){
this.driver = driver;
PageFactory.initElements(driver, this);
}
public void clickRoundTripRadioButton(){
iRoundTrip.click();
}
}
I am just trying to automate ibibo website.I am getting nullpointer exception for the above code.I am not able to understand where it is passing a null value.Pls help.Thank you