我有一個按鈕:按鈕點擊硒的Java
<input type="button" onclick="onOpenSessionClick()" value="Open device access">
但是當我做了命令:
driver.findElement(By.xpath("//input[@value='Open access device' and @type='submit']")).click();
的點擊沒有。 這裏是我的代碼:
if (isElementPresent((By.xpath("//input[@value='Open device access']"))))
{
System.out.println("Je suis dans le if");
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@value='Open device access' and @type='submit']")).click();
System.out.println("Je suis dans le if et jai open");
Thread.sleep(5000);
assertTrue(isElementPresent(By.xpath("/html/body/div[2]/div[3]/div[3]/div[2]/div/div[2]/div[2]/div/div[6]/div/div/div/p/span")));
assertTrue(isElementPresent(By.xpath("/html/body/div[2]/div[3]/div[3]/div[2]/div/div[2]/div[2]/div/div[6]/div/div/div[2]/input")));
assertTrue(isElementPresent(By.xpath("/html/body/div[2]/div[3]/div[3]/div[2]/div/div[2]/div[2]/div/div[6]/div/div/div[2]/input[2]")));
System.out.println("Je suis dans le if et je cherche");
}
我也有同樣的問題,任何解決方案?在我的情況下,瀏覽器被激活,A..B..C然後當它到達點擊該按鈕時,瀏覽器關閉。 – bademba 2016-08-13 09:08:43