I am trying to automate logging into http://wallethub.com/ using selenium java code. After clicking on Sign in link, a modal popup comes up with an iframe containing username and password fields, however I am not able to find the username field using following selenium code.
WebDriver d = new FirefoxDriver();
d.get("http://wallethub.com/profile/test_insurance_company/");
WebElement signIn = d.findElement(By.linkText("Sign In"));
signIn.click();
WebElement frame = d.findElement(By.tagName("iframe"));
WebDriver.TargetLocator locator = d.switchTo();
WebDriver frameDriver = locator.frame(frame);
WebElement active = locator.activeElement();
frameDriver.findElement(By.id("overlay-username")).sendKeys(user);
My code dies on the last line saying cannot find "overlay-username" field, however I have verified , this field exists in firebug console.
This is on linux.
Any help will be appreciated.
iframe? Common mistake I make when I just inspect the element and follow the breadcrumbs and don't bother looking at the source.