我想使用Assert來驗證在FB登錄頁面上顯示的月份。如何使用selenium webdriver中的斷言列表
但是我得到的輸出是不正確的。
下面是代碼:
public class DropDown3 {
@Test
public void selectByvalue() throws InterruptedException{
WebDriver driver = new FirefoxDriver();
driver.get("https://www.facebook.com/");
driver.manage().window().maximize();
WebElement month_dropdown= driver.findElement(By.id("month"));
Select month_dd = new Select(month_dropdown);
List<WebElement> month_list = month_dd.getOptions();
int total_months = month_list.size();
System.out.println("Total month Count is = " +total_months);
String[] exp = {"Month", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
for (WebElement ele: month_list){
for(int i=0;i<exp.length;i++){
if(ele.getText().equals(exp[i])){
System.out.println("Matched ");
}