package zacksolutions;

import com.microsoft.playwright.*;
import org.testng.annotations.Test;

/**
 * LocatorsTest
 */
public class LocatorsTest {

  @Test
  public void locatorsCount(){
    Playwright playwright = Playwright.create();
    Browser browser = playwright.firefox().launch(new BrowserType.LaunchOptions().setHeadless(false));
    BrowserContext browserContext = browser.newContext();
    Page page = browserContext.newPage();
    page.navigate("https://gitea.zacksolutions.dev/");
    Locator locatorSignin = page.locator("text = Explore");
    locatorSignin.click();
    page.locator("text = Users").click();
    Locator users = page.locator("div[class*='flex-item-title']");
    System.out.println(users.last().textContent());
    System.out.println(users.first().textContent());
    for (int i = 0; i <users.count(); i++) {
      System.out.println(users.nth(i).textContent());
    }
    browser.close();
  }
}
