Quaatso Education

Home Forums Selenium Forum "Unable to locate Element" error

"Unable to locate Element" error

This topic contains 1 reply, has 2 voices, and was last updated by  Nandan Singh 1 year, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3968

    Navin Mathur
    Participant

    Website :https://myvodafone.vodafone.in/

    While entering the vlaue in username text box getting an error “Unable to locate Element” .I tried to enter the value through id ,xpath ,css selector but getting the same problem agaian and again.I tried other cases also which i found on google .

    I am able to click on any button or link through selenium.

    #3969

    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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.