i am trying to play with autologin tests via selenium driver and python. I am using this site https://invoiceaccess.pgiconnect.com/ What i did:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://invoiceaccess.pgiconnect.com")
driver.find_element_by_id("LoginId").send_keys("test-account")
driver.find_element_by_id("LoginPassword").send_keys("test-password")
#driver.find_element_by_id("submit").click()
Everythyhing works, but i have a problem with selecting from drop-down menu. For example, i have html code of this menu.
<select class="regiondropdown" data-val="true" data-val-required="Please Select Region" id="Region" name="Region"><option value="">Select Region</option>
<option value="us">America</option>
<option value="europe">Europe</option>
<option value="apac">APAC</option>
</select>
I tried this:
element = driver.find_element_by_xpath("//select[@name='Region']")
all_options = element.find_elements_by_tag_name("option")
for option in all_options:
print("Value is: %s" % option.get_attribute("US"))
option.click()
For example, i need to select America, but it selects APAC. Where i made error, who can help me please ?
US