how to select Angular material drop down list option from excel sheet data/value/parameter with selenium webdriver Data driven concept and Using APACHE POI
Using extension in chrome called CSS and Xpath checker , it is possible to get xpath of elements for any dropdown list , text fields etc
Example suppose we have Dropdown list called Gender and the list contains 3 options called Male , Female and Others
so the WebDriver code will be as follows
driver.findElement(By.xpath("//span[.='Gender']")).click();
driver.findElement(By.xpath("//span[@class='mat-option-text' and contains(text(),'Male')]")).click();
or
driver.findElement(By.xpath("//span[@class='mat-option-text' and contains(text(),'Female')]")).click();
or
driver.findElement(By.xpath("//span[@class='mat-option-text' and contains(text(),'Others')]")).click();