0
我的目標是動態填充下拉列表。我有10個字符的密碼,我需要填寫三個單詞的任意組合。我可以使用類似Please fill 2,3 and 5 character
的消息來填充它,但這取決於字符串。如何在硒中動態填充下拉列表
我應該如何在硒中動態地做這件事情,以便自動識別未填充的盒子並給我填充的地方。
我一直在使用字符串
int identifingPlacesToField =0;
String masterPassword ="jeffhrdyrt";
try {
Thread.sleep(5000);
Matcher m = Pattern.compile("\\d+").matcher(driver.findElement(By.id("pass_Login_form")).findElement(By.tagName("div")).getText().toString());
while(m.find())
{
identifingPlacesToField++;
Select select = new Select(driver.findElement(By.id("sel"+identifingPlacesToField)));
select.selectByValue(String.valueOf(masterPassword.charAt(Integer.parseInt(m.group(0))-1)));
}
driver.findElement(By.id("passBtnSubmit")).click();
TestingHLTestCases.checkingPortfolioPage();
} catch (InterruptedException e) {
e.printStackTrace();
}
此匹配越來越什麼是數字實現這個代碼,我因此填充。但現在我想要一個類似的東西,而不使用字符串。
在此先感謝。