there are no iframe.
xpath for gmail password is [quote:1r84tshr].//*[@id='Passwd'][/quote:1r84tshr].
use that and get rid of all frame code.
sir,
Following is my code:
Issue is still d same.
--------------------
package p1;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class Login_verifyy_gmail {
@Test(dataProvider = "dp")
public void f(String n, String s) {
WebDriver w=new FirefoxDriver();
w.get("http://www.gmail.com/");
w.findElement(By.xpath("//*[@id='Email']")).sendKeys(n);
w.findElement(By.xpath("//*[@id='next']")).click();
w.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
w.findElement(By.xpath("//*[@id='Passwd']")).sendKeys(s);//====>Unable to locate element: {"method":"xpath","selector":"//*[@id='Passwd']"}
w.findElement(By.xpath("//*[@id='Passwd']")).sendKeys(Keys.ENTER);
System.out.println("n"+n+"s"+s);
}
@DataProvider
public Object[][] dp() {
/* return new Object[][] {
new Object[] { 1, "a" },
new Object[] { 2, "b" },*/
Object[][] x=new Object[1][2];
Xls_Reader x1=new Xls_Reader("C:\\Users\\chaitra\\Pictures\\shopping_cart.xlsx");
for(int i=0;i<1;i++)
{
x[i][i]=x1.getCellData("Login","Login_name",2);
x[i][1]=x1.getCellData("Login","pwd",2);
System.out.println("loginName"+x[i][i]+"loginName"+x[i][1]);
}
return x;
};
}
WebDriver w=new FirefoxDriver();
w.get("http://www.gmail.com/");
w.findElement(By.xpath("//*[@id='Email']")).sendKeys(n);
w.findElement(By.xpath("//*[@id='next']")).click();
thread.sleep(5000)
w.findElement(By.xpath("//*[@id='Passwd']")).sendKeys(s);//====>Unable to locate element: {"method":"xpath","selector":"//*[@id='Passwd']"}
w.findElement(By.xpath("//*[@id='Passwd']")).sendKeys(Keys.ENTER);