My code works on the first exapandable list Finds the Element but wont do it on next list below. I dont know why it would do so
driver = webdriver.Chrome()
driver.get("www.example.com")
time.sleep(2)
# Find the input element by its name
input_element = driver.find_element(By.NAME, "country")
time.sleep(2)
Input "Germany" into the element
input_element.send_keys("germany")
I tried find by id, Name and xpath but didn't manage it to work.
CodePudding user response:
You can use this for the fields on your webpage
input_country = driver.find_element(By.NAME, "country")
input_country.send_keys("Австрія")
time.sleep(2)
input_consulate = driver.find_element(By.NAME, "consulate")
input_consulate.send_keys("ПУ в Австрії")
time.sleep(2)
input_category = driver.find_element(By.NAME, "category")
input_category.send_keys("Паспортні дії")
time.sleep(2)
input_service = driver.find_element(By.NAME, "service")
input_service.send_keys("Засвідчення заяви про шлюбну правоспроможність")
time.sleep(2)
Germany is not present as an option in the list of countries. You need to select only from the options present in the list. The next dropdown will not be active if you enter invalid data in the dropdown