Skip to content

Commit 4c0c0f6

Browse files
committed
Change relative locator in date picker test
1 parent 739cb33 commit 4c0c0f6

File tree

4 files changed

+12
-12
lines changed
  • selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch03/locators_relative
  • selenium-webdriver-junit5-seljup/src/test/java/io/github/bonigarcia/webdriver/seljup/ch03/locators_relative
  • selenium-webdriver-junit5/src/test/java/io/github/bonigarcia/webdriver/jupiter/ch03/locators_relative
  • selenium-webdriver-testng/src/test/java/io/github/bonigarcia/webdriver/testng/ch03/locators_relative

4 files changed

+12
-12
lines changed

selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch03/locators_relative/DatePickerJUnit4Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ public void testDatePicker() {
6969
String.format("//th[contains(text(),'%d')]", currentYear)));
7070
monthElement.click();
7171

72-
// Click on the left arrow using relative locators
73-
WebElement arrowLeft = driver.findElement(
74-
RelativeLocator.with(By.tagName("th")).toRightOf(monthElement));
72+
// Click on the left arrow
73+
WebElement arrowLeft = driver.findElement(By.cssSelector(
74+
"div[class='datepicker-months'] th[class='prev']"));
7575
arrowLeft.click();
7676

7777
// Click on the current month of that year

selenium-webdriver-junit5-seljup/src/test/java/io/github/bonigarcia/webdriver/seljup/ch03/locators_relative/DatePickerSelJupTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ void testDatePicker(ChromeDriver driver) {
5757
String.format("//th[contains(text(),'%d')]", currentYear)));
5858
monthElement.click();
5959

60-
// Click on the left arrow using relative locators
61-
WebElement arrowLeft = driver.findElement(
62-
RelativeLocator.with(By.tagName("th")).toRightOf(monthElement));
60+
// Click on the left arrow
61+
WebElement arrowLeft = driver.findElement(By.cssSelector(
62+
"div[class='datepicker-months'] th[class='prev']"));
6363
arrowLeft.click();
6464

6565
// Click on the current month of that year

selenium-webdriver-junit5/src/test/java/io/github/bonigarcia/webdriver/jupiter/ch03/locators_relative/DatePickerJupiterTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ void testDatePicker() {
6969
String.format("//th[contains(text(),'%d')]", currentYear)));
7070
monthElement.click();
7171

72-
// Click on the left arrow using relative locators
73-
WebElement arrowLeft = driver.findElement(
74-
RelativeLocator.with(By.tagName("th")).toRightOf(monthElement));
72+
// Click on the left arrow
73+
WebElement arrowLeft = driver.findElement(By.cssSelector(
74+
"div[class='datepicker-months'] th[class='prev']"));
7575
arrowLeft.click();
7676

7777
// Click on the current month of that year

selenium-webdriver-testng/src/test/java/io/github/bonigarcia/webdriver/testng/ch03/locators_relative/DatePickerNGTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ public void testDatePicker() {
6969
String.format("//th[contains(text(),'%d')]", currentYear)));
7070
monthElement.click();
7171

72-
// Click on the left arrow using relative locators
73-
WebElement arrowLeft = driver.findElement(
74-
RelativeLocator.with(By.tagName("th")).toRightOf(monthElement));
72+
// Click on the left arrow
73+
WebElement arrowLeft = driver.findElement(By.cssSelector(
74+
"div[class='datepicker-months'] th[class='prev']"));
7575
arrowLeft.click();
7676

7777
// Click on the current month of that year

0 commit comments

Comments
 (0)