Iframe issue in chrome driver

Chrome driver does not recognize iframe tag as normal frame.

Where as driver for IE recognizes iframe as normal frame.

Following statement works in all browsers except chrome where it gives frame not found error:

driver.SwitchToFrame(3);

The third frame is defined using iframe tag and not frame tag.

Can somebody help me solve this issue?

vikas1912 Default Asked on March 11, 2015 in Selenium WebDriver.
Add Comment
1 Answer(s)

I think Chrome driver recognize iframe tag as normal frame like any other driver we have for firefox/IE,

this statement is supported by below code example

Automate below manual Test Steps for a chrome browser:
1. Go to paytm.com
2. Click login button, It opens a popup to perform login
3. Try to enter email inside the first text box on pop up, it will not work because pop up is inside a frame

I tried below code and it’s working on chrome it contains a iframe tag

public void paytm_login() throws InterruptedException{
driver.get(“http://paytm.com/”);
driver.manage().timeouts().implicitlyWait(100,TimeUnit.SECONDS);
driver.findElement(By.xpath(“//*[@class=’profile1′]/span[1]”)).click();
driver.manage().timeouts().implicitlyWait(100,TimeUnit.SECONDS);
driver.switchTo().frame(driver.findElement(By.xpath(“//iframe[@ng-hide=’showVerificationScreen’]”)));
driver.findElement(By.xpath(“//input[@name=’username’]”)).sendKeys(“test@gmail.com”);
driver.manage().timeouts().implicitlyWait(1000,TimeUnit.SECONDS);
driver.findElement(By.xpath(“//input[@name=’password’]”)).sendKeys(“test123″);
driver.manage().timeouts().implicitlyWait(40,TimeUnit.SECONDS);
driver.findElement(By.xpath(“//*[@type=’submit’]”)).click();
driver.manage().timeouts().implicitlyWait(1200,TimeUnit.SECONDS);
}

amitjain Supporter Answered on March 11, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.