我測試的角度JS應用測試Angularjs應用與硒
當我點擊Web應用程序我得到以下錯誤的UI套件鏈接 -
在demoaj.Ajapp.main(Ajapp.java:16)引起: org.openqa.selenium.NoSuchElementException:無法找到元素: {「method」:「xpath」,「selector」:「html/body/div 1/div 1 /拋開/ DIV/DIV/UL /李[2]/A「} 命令持續時間或超時:51毫秒有關此 錯誤文檔,請訪問: http://seleniumhq.org/exceptions/no_such_element.html
我是新來這個我沒在此方面的研究AngularJS
Java代碼
package demoaj;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Ajapp {
public static void main(String[] args) throws InterruptedException {
WebDriver d=new FirefoxDriver();
d.manage().window().maximize();
d.get("http://iarouse.com/demo/index.html?product=square");
WebDriverWait wait = new WebDriverWait(d, 20);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("html/body/div[1]/div[1]/aside/div/div/ul/li[2]/a"))).click();
//d.findElement(By.xpath("html/body/div[1]/div[1]/aside/div/div/ul/li[2]/a")).click();
}
}
我想是因爲在angularjs DOM不可渲染它無法找到的元素。當我檢查頁面的源代碼時,它沒有顯示任何東西隱藏後做了一些關於angularjs測試的研究,我有幾個問題請幫忙,
用於Angular App測試。
- 我想我必須使用量角器?我猜
- 如果我使用量角器我必須在JavaScript或jQuery中編寫代碼?
- 如果我使用量角器可以使用eclipse ide或intellij在java中編寫我的代碼嗎?
請幫幫忙,
在此先感謝。