What I want
Open a browser using Selenium, making you go to a website (eg link ) driver.get("http://www.google.com");
and type in its text field a search element.sendKeys("Cheese!");
after finalizing submit form to search element.submit();
Problem
The driver instance is successful and Firefox opens, but it will be in the initial screen "Blank page" without doing anything else. It does not have an error message, it just does not.
Code
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
public class TesteAutomatizado {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese!");
element.submit();
System.out.println("Page title is: " + driver.getTitle());
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().toLowerCase().startsWith("cheese!");
}
});
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
}
}
Question
I've looked in various places on the internet and the examples are the same. Would anyone have any idea what might be going on?