测试与硒Angularjs应用 [英] Testing Angularjs Application with Selenium
问题描述
我测试的角度JS应用
链接角的js应用
当我点击该Web应用程序我收到以下错误UI套件链接 -
when i click on the UI Kit link on the web application i am getting the following error -
在demoaj.Ajapp.main(Ajapp.java:16)引起的:
org.openqa.selenium.NoSuchElementException:找不到元素:
{方法:的XPath,选择:HTML /体/ DIV 1 / DIV 1 /预留/ DIV / DIV / UL /李[ 2] /一个}
命令持续时间或超时:51毫秒为单位的文档在这
错误,请访问:
http://seleniumhq.org/exceptions/no_such_element.html
at demoaj.Ajapp.main(Ajapp.java:16) Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"html/body/div1/div1/aside/div/div/ul/li[2]/a"} Command duration or timeout: 51 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
我是新来这个我做了这个AngularJS一些研究
I am new to this i did some research on this AngularJS
Java的code
java Code
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测试做一些研究后隐藏我有几个问题请大家帮忙,
I think it is not able to find the element because in angularjs the dom is not rendering. when i check the page source it does not display anything all things are hidden after doing some research on angularjs testing i have few question please help,
有关角应用测试。
- 我想我已经用量角器?我猜
- 如果我用量角器我必须写code在JavaScript或jQuery的?
- 如果我用量角器可以用我的Eclipse IDE的IntelliJ或写我的code在java中?
请帮助,
在此先感谢。
推荐答案
下面是一些我用它来测试我的AngularJS应用技巧:
Here are some of the techniques I use to test my AngularJS Applications :
- 查找到噶框架。这是非常好,具有良好的文档以及。
https://karma-runner.github.io/0.8/plus/AngularJS.html - 如果你更进终端到终端的测试,请用量角器,因为它被证明是一次又一次,这是最好的。
https://angular.github.io/protractor/#/
- Look into Karma framework. It is very good and has good documentation as well. https://karma-runner.github.io/0.8/plus/AngularJS.html
- If you're more into end-to-end testing please use Protractor as it is proven time and time again that it is the best. https://angular.github.io/protractor/#/
这篇关于测试与硒Angularjs应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!