I want to open the site www.flock.co and enter a email in the text field.However the program only opens the site and doesnt enter the email in the field.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FindByClassName {
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.gecko.driver", "C:\\Automation\\geckodriver-v0.15.0-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://flock.co/");
driver.findElement(By.className("_g-s-wrap")).sendKeys("farzan.s@flock.co");
}
}
_g-s-wrap
is the class of a container that includes more features (like the "Get Started" button). Use cssSelector
to locate the <input>
textbox
driver.findElement(By.cssSelector("[type='email']")).sendKeys("farzan.s@flock.co");