Unable to select value from list

I know that the question is quite simple for you to answer, but I’m stuck in the list of transitions from where I wanted to choose the month of birth.

I work on other sites, but, unfortunately, I can not get this to work.

I tried:

Click using different locators. Using the Action class to move the cursor and click. Use Java Script to select the month.

It is strange if I get the text WebElement, I can do it, but I can not click on it.

Application URL: link !

This is when creating a google account.

enter image description here

I tried to select a month from the list in any month.

I have a TimeOutException when I wait until the field receives the desired month.

In addition, I am not mistaken. Script always passes without a choice.

I know the question is pretty simple, but if someone can help me get through it.

Thanks in advance.

<span id="BirthMonth" class=" form-error" aria-invalid="true"> <div class="goog-inline-block goog-flat-menu-button jfk-select" role="listbox" style="-moz-user-select: none;" aria-expanded="false" tabindex="0" aria-haspopup="true" aria-activedescendant=":0" title="Birthday"> <div class="goog-menu goog-menu-vertical" style="-moz-user-select: none; visibility: visible; left: 0px; top: -82.2333px; display: none;" role="listbox" aria-haspopup="true"> <div id=":1" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":2" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div class="goog-menuitem-content">February</div> </div> <div id=":3" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":4" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":5" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":6" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":7" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":8" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":9" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":a" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":b" class="goog-menuitem" role="option" style="-moz-user-select: none;"> <div id=":c" class="goog-menuitem" role="option" style="-moz-user-select: none;"> </div> <input id="HiddenBirthMonth" type="hidden" name="BirthMonth"> </span> 
+6
source share
3 answers

Have you tried with sendkey? I hope that with sendkey it will work

 driver.findElement(By.xpath(".//*[@id='BirthMonth']/div[1]")).sendKeys("april"); 

thanks

+2
source

Please try the code below. It should work.

 Select(driver.findElement(By.id("BirthMonth"))).selectByVisibleText("February"); 

If not, first click on the drop-down list. Then save all the values ​​in the drop-down list to an array or list, and then select the desired value from the list / array.

0
source

You can click BirthMonth first to open the drop-down menu, and then click the month that you want. See below to select June:

 driver.findElement(By.cssSelector("#BirthMonth > div")).click(); driver.findElement(By.xpath("//*[contains(text(),'June')]")).click(); 
0
source

All Articles