Advertisement
Guest User

Selenide and CSS/XPATH - 4th review

a guest
Feb 25th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. @Test
  2.     public void completeTask() {
  3.         Configuration.browser = "chrome";
  4.         open("http://todomvc.com/examples/emberjs/");
  5.  
  6.         $("#new-todo").setValue("a").pressEnter();
  7.         $("#new-todo").setValue("b").pressEnter();
  8.         $("#new-todo").setValue("c").pressEnter();
  9.  
  10.         $$("#todo-list li").shouldHave(exactTexts("a", "b", "c"));
  11.         $("#todo-list li:nth-child(2) .toggle").click();
  12.         $("#todo-list li.completed").shouldHave(exactText("b"));
  13.         $$("#todo-list li:not(.completed)").shouldHave(exactTexts("a", "c"));
  14.     }
  15.  
  16. @Test
  17.     public void completeTask() {
  18.         Configuration.browser = "chrome";
  19.         open("http://todomvc.com/examples/emberjs/");
  20.  
  21.         $x("//*[@id='new-todo']").setValue("a").pressEnter();
  22.         $x("//*[@id='new-todo']").setValue("b").pressEnter();
  23.         $x("//*[@id='new-todo']").setValue("c").pressEnter();
  24.  
  25.         $$x("//*[@id='todo-list']//li").shouldHave(exactTexts("a", "b", "c"));
  26.         $x("//*[@id='todo-list']//li//*[.//label='b']/*[" + XPredicate.byCssClass("toggle") + "]").click();
  27.         $x("//*[@id='todo-list']//li["+ XPredicate.byCssClass("completed") + "]").shouldHave(exactText("b"));
  28.         $$x("//*[@id='todo-list']//li[not("+ XPredicate.byCssClass("completed") + ")]").shouldHave(exactTexts("a", "c"));
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement