Пример #1
0
  // This method is giving error as uncheck is not working as expected
  @Test
  public void testScrollcheck() {
    try {
      // hover on shop by department in amazon.com
      // webpage.findObjectById("nav-shop").hover();
      webpage.findObjectByxPath(prop.getProperty("amazon_shop_by_department")).hover();

      // Thread.sleep(1000);

      // click on clothing, shoes & jewellery
      webpage.findObjectByxPath(prop.getProperty("amazon_clothing_shoes_jewellery")).hover();

      // Thread.sleep(1000);

      // click on Men
      webpage.findObjectByxPath(prop.getProperty("amazon_men")).click();

      // click on watches
      webpage.findObjectByxPath(prop.getProperty("amazon_watches")).click();

      // check casual
      webpage.scrollDown(3);
      webpage.findObjectByxPath(prop.getProperty("amazon_watches_casual")).check();
      Thread.sleep(2000);

      // check Luxury
      webpage.scrollDown(3);
      Assert.assertTrue(
          webpage.findObjectByxPath(prop.getProperty("amazon_watches_casual")).isEnabled());
      webpage.findObjectByxPath(prop.getProperty("amazon_watches_fashion")).check();
      Thread.sleep(2000);

      // uncheck Luxury
      webpage.scrollDown(3);
      webpage.findObjectByxPath(prop.getProperty("amazon_watches_fashion")).uncheck();

      webpage.scrollDown(1);
      Assert.assertFalse(
          webpage.findObjectByxPath(prop.getProperty("amazon_watches_fashion")).isEnabled());
      Thread.sleep(2000);

    } catch (Exception ex) {
      log.error(ex.getMessage());
    }
  }