Select dropdown in AngularJS application from Python Selenium
<p>I wanted to test page in <code>Python</code> <code>Selenium</code>, which uses <code>AngularJS</code>. It contains a select option and I have tried a number of options to select it but it fails.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select id="xtzpp001" ng-model="..." ng-options="...." ng-change="changeView()"&gt;
  &lt;option value class&gt;select&lt;/option&gt;
  &lt;option value="200" selected="selected"&gt;Student 1&lt;/option&gt;
  &lt;option value="201"&gt;Student 2&lt;/option&gt;
  &lt;option value="202"&gt;Student 3&lt;/option&gt;
&lt;/select&gt;</code></pre>
</div>
</div>
</p>

<p>As I said, I tried---</p>

<pre><code>driver.find_element_by_xpath('//select[@id="xtzpp001"]/option[contains(text(), "Student 2")]').click()
</code></pre>

<p>then</p>

<pre><code>from selenium.webdriver.support.ui import Select

select = Select(driver.find_element_by_id('xtzpp001'))
for i in select.options:
   .......etc etc
</code></pre>

<p>I used explicit waits also.</p>

<p>I came to know that pytractor can help me in this situation (not being actively developed though), but I am unable to find any documentation regarding select option using pytractor.</p>

<p>Is there any other way to achieve this?? or pytractor equivalent? </p>

<p>Or can I use protractor(or any javascript framework) to continue in testing in <code>Javascript</code> from this stage and integrate/callback the results in <code>Python</code>??</p>

<p>you can also use Actions to click the menu item, here is an example:</p>

<pre><code>menu = driver.find_element_by_css_selector(".nav")
hidden_submenu = driver.find_element_by_css_selector(".nav #submenu1")

ActionChains(driver).move_to_element(menu).click(hidden_submenu).perform()
</code></pre>

python selenium protractor