Selenium For Beginners

Share this post

User's avatar
Selenium For Beginners
Is your page method doing too much?
Page Class

Is your page method doing too much?

Alex Siminiuc's avatar
Alex Siminiuc
Jan 27, 2025
∙ Paid
2

Share this post

User's avatar
Selenium For Beginners
Is your page method doing too much?
Share

Let’s use the following method for this discussion:

public void setOption(String optionName) {
   WebElement dropDown = driver.findElement(dropDownBy);
   dropdown.click();

   List<WebElement> options = driver.findElements(optionsBy);

   for (WebElement option : options) {
      if (option.getText().equalsIgnoreCase(FILTER)) {
         option.click();
         break;
      }
   }

   saveChanges();

   refreshPage();

   waitForHeaderToAppear();
}

Is this method doing too much?

Keep reading with a 7-day free trial

Subscribe to Selenium For Beginners to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Alex Siminiuc
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share