[英]Selecting value from the drop-down using Selenium webdriver
select s =new select(driver.findElement(By.name("country")));
s.selectByVisibleText("INDIA");
和
await driver.findElement(By.name('country')).getText(INDIA).click();
我已經嘗試過這兩種情況,但同時我都收到一條錯誤消息。
你能幫我解決這個問題嗎?
請嘗試以下代碼:
const element = await driver.findElement(By.name('country'));
//const children = await element.findElements(By.tagName('option'));
await element.findElement(By.xpath('option[@value="INDIA"]')).click();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.