As dropdown you want to select value from is not a select type tag, Selenium Select method wont work on it. You have to follow below steps:
Since you have not given complete HTML, below is the dummy code:
driver.FindElement(By.XPath("//input[@data-testid='register-country']")).Click() // Click on dropdown
IJavaScriptExecutor executor = (IJavaScriptExecutor)driver;
executor.ExecuteScript("arguments[0].click();", driver.FindElement(By.XPath("//*[text()='Austria']"))); //You can give more accurate xpath for country you want to select based on other HTML attributes
You can also try with below code
IWebElement element = driver.FindElement(By.ClassName("tp-select-input")); driver.FindElement(By.XPath("//span[text()='Australia']")); element.SendKeys(OpenQA.Selenium.Keys.Down); element.SendKeys(OpenQA.Selenium.Keys.Return);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.