I want to automate some browser tasks using Python and Selenium webdriver on a Chromium browser. My python script can already log in, go to the subpage / make a few clicks and paste something into the form.
My problem is a mandatory drop-down list where I must select something before I can continue. I think the webpage contains angularjs / javascript at this point (third line in the code below) to create a drop-down list, and I don't know how to handle this.
It seems that the problem is 1) to find the element (sometimes the xpath sometimes changes), and 2) I cannot click or send the keys to what I found. I also tried some kinds of "WebDriverWait" and sleep commands and "wait.until (expected_conditions.visibility_of_element_located ((By.XPATH, ...))" ... so far no luck.
Is it possible to solve this problem only with Python and Selenium? Or do I need something like Protractor (and does Protractor only do with Javascript commands)? I also saw Pytractor ...
I'm new to this question, can someone explain what could be a good way to solve this problem? Thanks in advance...:)
The code for the webpage is as follows (using Firebug / Firepath):
<div class="ng-scope ng-isolate-scope" model-contains-key="true" ref="salutations" cat-input-select="editDetail.salutation">
<div id="s2id_autogen1" class="select2-container form-control ng-untouched ng-valid ng-dirty ng-valid-parse">
<a class="select2-choice select2-default" tabindex="-1" href="javascript:void(0)">
<span id="select2-chosen-2" class="select2-chosen"/>
<abbr class="select2-search-choice-close"/>
<span class="select2-arrow" role="presentation">
<b role="presentation"/>
</span>
</a>
<label class="select2-offscreen" for="s2id_autogen2"/>
<input id="s2id_autogen2" class="select2-focusser select2-offscreen" type="text" role="button" aria-haspopup="true" aria-labelledby="select2-chosen-2"/>
<div class="select2-drop select2-display-none select2-with-searchbox">
<div class="select2-search">
<label class="select2-offscreen" for="s2id_autogen2_search"/>
<input id="s2id_autogen2_search" class="select2-input" type="text" aria-autocomplete="list" aria-expanded="true" role="combobox" spellcheck="false" autocapitalize="off" autocorrect="off" autocomplete="off" aria-owns="select2-results-2" placeholder=""/>
</div>
<ul id="select2-results-2" class="select2-results" role="listbox"/>
</div>
</div>
<select class="form-control ng-untouched ng-valid ng-dirty ng-valid-parse" ng-change="modelChanged(); changeCallback({value: selectValue.value})" ng-readonly="readonly" ng-disabled="disabled" ng-model="selectValue.value" ui-select2="{dropdownAutoWidth: 'true', allowClear: 'false'}" tabindex="-1" title="" style="display: none;">
<option value=""/>
<option class="ng-binding ng-scope ng-isolate-scope" cat-i18n="xxxxxxx.salutation.Mr" value="Mr" ng-repeat="option in options">Mr</option>
<option class="ng-binding ng-scope ng-isolate-scope" cat-i18n="xxxxxxx.salutation.Ms" value="Ms" ng-repeat="option in options">Ms</option>
</select>
</div>