Frage

When i execute a program with below code snippet, click on a link worked fine on Windows7+Firefox28, but not on Windows8+Firefox28.

page navigated to Flipkart, searched for Samsung S3 but not clicking on the selected item to open its specifications, etc.

It is observed that the print line after click is executed.

    public static void main(String[] args) {
    WebDriver d = new  FirefoxDriver();
    d.manage().window().maximize();
    d.get("http://www.flipkart.com/");
    d.findElement(By.xpath(".//*[@id='fk-top-search-box']")).sendKeys("Samsung s3");
    d.findElement(By.xpath(".//*[@id='fk-header-search-form']/div/div/div[2]/input[1]")).click();

    //below is the line where, click which doesn't run on windows8+firefox28
    d.findElement(By.xpath(".//*[@id='products']/div/div/div/div/div/a[contains(.,'Samsung Galaxy S3 (Marble White')]")).click();

    System.out.println("After clicking on selected item..."); 
    }
War es hilfreich?

Lösung

In some cases, click() does not work directly. In those cases, you can try on using sendkeys method.

driver.findElement(By.xpath("blah")).sendKeys(Keys.ENTER);

I am not sure of the reason, but it works when click does not work.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top