1
votes

I am trying to login into Sears.com using Selenium webdriver.clicked on Sign in link-->login form opens.

But unable to locate the text box element inside the login form. The login form is inside an iframe (frame Name =easyXDM_default5914_provider).This iframe is inside div (id=modaliframe)

driver.switchTo().frame(driver.findElement(By.xpath(".//iframe[@id='easyXDM_default5914_provider']")));
driver.switchTo().activeElement();
driver.findElement(By.id("email")).sendKeys("[email protected]");

Getting below exception in my console:

org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"email"}

1
Why do you switchTo().activeElement()? Also the IFRAME ID seems to change, so try .//iframe[starts-with(@name, 'easyXDM_')] - D.R.

1 Answers

0
votes

Try with the below code.

driver.get("http://www.sears.com/");
driver.findElement(By.xpath("//*[@id='header-shop-your-way-partner']")).click();
driver.findElement(By.xpath("//*[@id='open-sign-in-form']/span[2]")).click();
driver.switchTo().frame("registration-form-iframe");
driver.findElement(By.xpath("//*[@id='email']")).sendKeys("[email protected]");
Thread.sleep(3000);