I want Selenium to choose an option but it didn't work for me I tried this
phone = Select(driver.find_element(By.NAME, "PhoneCountry"))
phone.select_by_data-value(self, US)
and it failed
And this is the html
I want Selenium to choose an option but it didn't work for me I tried this
phone = Select(driver.find_element(By.NAME, "PhoneCountry"))
phone.select_by_data-value(self, US)
and it failed
And this is the html
There is no such way to select option by_data-value.
There only 3 ways:
References:
official documentations
www.geeksforgeeks.org
So, instead of your code please try this:
phone = Select(driver.find_element(By.NAME, "PhoneCountry"))
phone.select_by_visible_text(self, "US")
I don't know what is the actual visible text there, it can be "US", or "USA" or something else.