Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle signup page: Selenium cannot find select listbox
    primarykey
    data
    text
    <p>I would like to use selenium to select a value in the <code>Month</code> list box for birthday on google page: <a href="https://accounts.google.com/SignUp" rel="nofollow">https://accounts.google.com/SignUp</a></p> <p>When I view page code, the code for the list box looks like:</p> <pre><code>&lt;select id="BirthMonth" name="BirthMonth"&gt; &lt;option value=""&gt;Month&lt;/option&gt; &lt;option value="01" &gt;January&lt;/option&gt; &lt;option value="02" &gt;February&lt;/option&gt; ...... &lt;option value="12" &gt;December&lt;/option&gt; &lt;/select&gt; </code></pre> <p>However, when I use Selenium <code>driver.findElements()</code>, I cannot find this <code>select</code> and its <code>option</code> elements. It looks like every list box on this page (as well as <code>gender</code> one) cannot be accessed. </p> <p>Can anyone give some suggestion how Selenium can access to these elements? Thanks</p> <p>The code is as follows:</p> <pre><code>driver.get("https://accounts.google.com/SignUp"); List&lt;WebElement&gt; inputElements = driver.findElements(By.xpath("//select[@name]")); for(WebElement input: inputElements){ if(input.getTagName().equals("select")){ Select selectinput = new Select(input); List&lt;WebElement&gt; selects = selectinput.getOptions(); } } </code></pre> <p>I did not get the <code>select</code> element I want. </p> <p>EDIT:</p> <p>I also try to use <code>Select select1 = new Select(driver.findElement(By.tagName("select")))</code> but still cannot find this <code>BirthMonth</code> list box. It is wired. There is only one listbox which is inside Javascritpt that can be accessed.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload