Quaatso Education

Home Forums Selenium Forum "Unable to locate Element" error Reply To: "Unable to locate Element" error

Reply To: "Unable to locate Element" error

Home Forums Selenium Forum "Unable to locate Element" error Reply To: "Unable to locate Element" error

#3969
Profile photo of Nandan Singh
Nandan Singh
Keymaster

Navin,

You are not able to find element because the element is not on “HTML Page”. The element is embedded inside an “I-Frame”.
So, in order to get any element of IFrame, we first need to “Switch to IFrame”. Here is code you require:

public class VodaphoneExample {

public static void main(String[] args) {

WebDriver driver = new FirefoxDriver();

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

driver.get(“https://myvodafone.vodafone.in/”);
driver.switchTo().frame(“portlet2_iframe”);

driver.findElement(By.id(“ssousernameUI”)).sendKeys(“MYUserName”);
}

}

Hope this will resolve your query.