driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get(URL);
I'm trying to run my test in Firefox using version 46.0.1 and webdriver 2.53.0 but when I run the test I see Firefox start and then close very quickly. I've got all other browsers to work and am at a loss as to what I'm missing here.
@BeforeClass
public static void setUp() {
System.out.println("****************");
System.out.println("launching Browser");
driver = new FirefoxDriver();
driver.get("url");
@Test
public void testPageTitleInBrowser() {
FirstPage firstPage = PageFactory.initElements(driver, FirstPage.class); firstPage
.logIn(username, password)
.clickHolidayLink()
.completeHolidayFormAndSubmit("12/05/2016");
}
@AfterClass
public static void tearDown() {
if (driver != null) {
System.out.println("Closing browser");
driver.quit();
}
}
Mainpage has been changed to firstpage
import com.google.common.annotations.VisibleForTesting;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import static Internal.BaseTest.driver;
public class FirstPage {
@VisibleForTesting
@FindBy(id = "ctl00_MCPH_MainLogin_UserNameTextBox")
WebElement usernameInput;
@VisibleForTesting
@FindBy(id = "ctl00_MCPH_MainLogin_PasswordTextBox")
WebElement passwordInput;
@VisibleForTesting
@FindBy(id = "ctl00_MCPH_MainLogin_LoginButton")
WebElement loginButton;
public BookAHoliday logIn(String username, String password){
usernameInput.sendKeys(username);
passwordInput.sendKeys(password);
loginButton.click();
return PageFactory.initElements(driver, BookAHoliday.class);
}
}