0

I am executing Selenium/TestNG script for Gmail Login in WindowsXP/IE8. Script enters userid and password correct in that page, but it is not clicking on 'Signin'option in Gmail.

I ran same script in Windows7/IE9, it worked. Same script is also working for Firefox. Please Advise.

Selenium Version: 2.25.0

import org.testng.annotations.*;
import org.openqa.selenium.*;
import org.openqa.selenium.ie.*;


public class New_Booking_Inc {
    private WebDriver driver;
    private String baseUrl;

    @BeforeTest
    public void Open_IE() throws Exception {
        System.setProperty("webdriver.ie.driver", "C:\\WINDOWS\\system32");
        driver = new InternetExplorerDriver();
        baseUrl = "http://www.gmail.com";
        driver.get(baseUrl);
    }

    @Test (testName = "Login")
    public void Login() throws Exception {
        //driver.get(baseUrl);
        driver.findElement(By.id("Email")).clear();
        driver.findElement(By.id("Email")).sendKeys("extsc2");
        Thread.sleep(1000);
        driver.findElement(By.id("Passwd")).clear();
        driver.findElement(By.id("Passwd")).sendKeys("Passwords");
        Thread.sleep(1000);
        driver.findElement(By.id("signIn")).click();
        Thread.sleep(5000);
    }

    @AfterTest
    public void Close_IE() throws Exception {
        driver.quit();
    }

}
4

2 に答える 2

0

.click()が正しく機能しないIEの既知の問題がいくつかあります。

試してみましたか:

    driver.findElement(By.id("signIn")).SendKeys("\n");
于 2012-12-10T18:43:22.937 に答える
0

Try it out driver.findElement(By.id("signIn")).sendKeys(Keys.ENTER);

or use different xpath ""

于 2012-12-12T07:28:56.333 に答える