I am testing an angular js application
Link Angular js App
when i click on the UI Kit link on the web application i am getting the following error -
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
I am new to this i did some research on this AngularJS
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();
}
}
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,
for Angular App testing.
Please Help,
Thanks in advance.
Here are your answers -
Advantage would be that you can write Javascript code (which is simpler than Java) to test your angular app and you don't have to worry about how the AngularJS works on your page. Only thing that might confuse you is using promises which is taken from WebdriverJS. Hope this helps.
Here are some of the techniques I use to test my AngularJS Applications :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With