문제

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..."); 
    }
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top