html - Setting the value of an <input> dropdown in Selenium with Python -
i have html page containing form tag. want set value of drop down in tag using selenium.
this how retrieve input element:
driver.find_element_by_xpath("/html/body/div[2]/div/div/form/div/div[1]/div[3]/div[1]/div/div[1]/input")
i tried set value using select_month.send_keys("09")
not accepted web page when try submit form need find method.
edit: here html of form, have ensured right element in x-path:
<input autocomplete="off" tabindex="-1" class="ui-select-search ui-select-toggle ng-pristine ng-valid ng-touched" ng-click="$select.toggle($event)" placeholder="select month" ng-model="$select.search" ng-hide="!$select.searchenabled || ($select.selected && !$select.open)" ng-disabled="$select.disabled" type="text">
after messing around bit , incorporating better practice presented alecxe, solution worked...
driver.find_element_by_xpath("//input[@placeholder='select month']").click() driver.find_element_by_xpath("//*[contains(text(), '09')]").click()
Comments
Post a Comment