|
1 | 1 | package io.github.mfaisalkhatri.tests; |
2 | 2 |
|
3 | | -import com.microsoft.playwright.*; |
| 3 | +import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; |
| 4 | +import static org.testng.Assert.assertEquals; |
| 5 | + |
| 6 | +import java.util.regex.Pattern; |
| 7 | + |
| 8 | +import com.microsoft.playwright.Browser; |
| 9 | +import com.microsoft.playwright.BrowserType; |
| 10 | +import com.microsoft.playwright.Locator; |
| 11 | +import com.microsoft.playwright.Page; |
| 12 | +import com.microsoft.playwright.Playwright; |
| 13 | +import com.microsoft.playwright.options.AriaRole; |
4 | 14 | import com.microsoft.playwright.options.SelectOption; |
5 | 15 | import org.testng.annotations.AfterClass; |
6 | 16 | import org.testng.annotations.BeforeClass; |
7 | 17 | import org.testng.annotations.Test; |
8 | 18 |
|
9 | | -import java.util.regex.Pattern; |
10 | | - |
11 | | -import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; |
12 | | -import static org.testng.Assert.assertEquals; |
13 | | - |
14 | 19 | public class DropdownTests { |
15 | 20 |
|
16 | 21 | private Playwright playwright; |
@@ -65,13 +70,12 @@ public void testSelectByIndex() { |
65 | 70 | @Test |
66 | 71 | public void testSelectByValue() { |
67 | 72 |
|
68 | | - this.page.navigate("https://www.lambdatest.com/selenium-playground/select-dropdown-demo"); |
69 | | - final Locator dropdownField = this.page.locator("#select-demo"); |
| 73 | + this.page.navigate ("https://the-internet.herokuapp.com/dropdown"); |
70 | 74 |
|
71 | | - dropdownField.selectOption(new SelectOption().setValue("Wednesday")); |
| 75 | + this.page.getByRole (AriaRole.COMBOBOX) |
| 76 | + .selectOption ("Option 2"); |
72 | 77 |
|
73 | | - final Locator daySelected = this.page.locator(".pt-10 p"); |
74 | | - assertThat(daySelected).hasText("Day selected :- Wednesday"); |
| 78 | + assertThat (page.getByRole (AriaRole.COMBOBOX)).containsText ("Option 2"); |
75 | 79 | } |
76 | 80 |
|
77 | 81 | @Test |
|
0 commit comments