Advertisement
zhytnytskyi

XPath Task

Apr 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package ua.com.azhytnytskyi.xpathtask;
  2.  
  3. import com.codeborne.selenide.Configuration;
  4. import org.junit.Test;
  5. import ua.com.azhytnytskyi.util.XpathUtil;
  6.  
  7. import static com.codeborne.selenide.CollectionCondition.exactTexts;
  8. import static com.codeborne.selenide.Selenide.*;
  9.  
  10. public class TodoMvcTest {
  11.  
  12.     @Test
  13.     public void completeTask(){
  14.         open("http://todomvc.com/examples/emberjs");
  15.  
  16.         $x("//*[@id='new-todo']").setValue("a").pressEnter();
  17.         $x("//*[@id='new-todo']").setValue("b").pressEnter();
  18.         $x("//*[@id='new-todo']").setValue("c").pressEnter();
  19.  
  20.         $$x("//*[@id='todo-list']/li").shouldHave(exactTexts("a","b","c"));
  21.  
  22.         $x("//*[@id='todo-list']/li[.//text()='b']//*[" + XpathUtil.byCssClass("toggle") + "]").click();
  23.  
  24.         $$x("//*[@id='todo-list']/li[contains(@class,'completed')]").shouldHave(exactTexts("b"));
  25.  
  26.         $$x("//*[@id='todo-list']/li[not(contains(@class,'completed'))]").shouldHave(exactTexts("a","c"));
  27.  
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement