This content has been marked as final.
Show 2 replies
-
1. Re: graphene wait api question
jhuska Sep 27, 2013 9:56 AM (in response to kgoedert)1 of 1 people found this helpfulHello Kelly,
waitAjax().withTimeout(10, TimeUnit.SECONDS).until().element(By.id("deleteDialog")).is().present();
should work for you.
If clicking on the deleting link fire an AJAX request, more powerful waiting in this situation would be using of Graphene.guardAjax, like this:
@Test public void deleteUser(){ this.insertDataAndGetLoginUrl(); loginPage.login("admin", "Admin123"); userPage.registerUser("deleteme", "Admin123", "Admin123", "15/02/2010", "test"); Graphene.guardAjax(browser.findElement(By.xpath("//a[@id='userTable:4:delete_link']/i"))).click(); browser.findElement(By.id("yes_button")).click(); /.. the rest is the same
Guard will wait until the AJAX request is done as its side effect. Its main reason is asserting that the AJAX request was made.
Off topic: Have you considered to use e.g:
@FindBy(xpath="//a[@id='userTable:4:delete_link']/i") WebElement deleteLink;
And other page abstractions can give you more readable tests in result.
-
2. Re: graphene wait api question
kgoedert Sep 27, 2013 10:16 AM (in response to jhuska)Thanks, it works now. I used your suggestions and I also had to get the element by a css selector instead of the id (I suppose primefaces may be changing the id by appending a value.)