How to handle web dropdown for below action method & Also How should I write reusable method for such Action?



  • How to create Page Object for such element with Reusable Action Method ?

    Methods to include:

    A method to select an option from list dropdown, example: selectFromList(String option)
    

    enter image description here

    enter image description here



  • By looking at the image of markup attached not clears the exact situation, because as per HTML markup it seems an input element and in first image it shows a drop-down. But, you can do something like this as reusable method:

    selectFromList(String option) {
       //use xpath or css selector here
       WebElement selectOption = driver.findElement(By.xpath("//table/span/input[@title="+option+"]"))
       selectOption.click()
    }
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2