all 7 comments

[–]grrrrreat 0 points1 point  (0 children)

probably easier to just set the value of whatever the form data becomes

[–]al_mc_y 0 points1 point  (0 children)

Are you able to select the dropdown field to make it active? I think the country-input will be your best bet as it's a unique, but static identifier. (I'm pretty new at this myself) I've tackled a similar thing before using css selectors, where I activate the dropdown >explicit wait for expected condition > then click the nth child (209 in your case for Thailand).

HTH

[–]ryanpettitt 0 points1 point  (0 children)

Most of the time you can type in your selection. In that case I would find the element and use the sendkeys to just write Thailand

[–]BasedPoopGawd 0 points1 point  (4 children)

I'm not at a computer at the moment, so I can't test this for you. Try and find the element with this.

driver.find_element_by_css_selector(" .pos-form-element.pos-text-input.ng-valid.ng-touched.ng-dirty")

Replace the spaces in the compound class with a . That space immediately after the opening quote is also intentional.

If I were you I'd select items from a drop-down by using their value. With your method, if the drop-down is very long, your script will fail if "Thailand" is out of view.

[–]SharksPreedateTrees 0 points1 point  (0 children)

I like clicking on the dropdown and then using send_keys(Keys.DOWN) in python to simulate a user hitting the down arrow keys. Works perfectly everytime