Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Selenium select

  • 17-06-2016 11:14AM
    #1
    Registered Users, Registered Users 2 Posts: 3,500 ✭✭✭


    Just learning a bit about Selenium at the moment and have run into a small problem.

    I am trying to fill out the sign up form for gmail using Selenium but I am having trouble with the drop down menu for selecting the month

    The page I am looking at is https://accounts.google.com/SignUp?service=mail&continue=http%3A%2F%2Fmail.google.com%2Fmail%2Fe-11-1458d58e30b42dfda7812f74da6c809d-064315f6ccb2bbc1261c0e633c0a4c365b1513b4

    and the element is <select id="BirthMonth" name="BirthMonth" >

    I am trying to select an option for this element but no matter what way I try to access the element it does not show up as a select tag.

    If I access by id I will get an error saying 'element should have been select but was "span"'

    If I access it by name I get a similar error saying 'element should have been select but was input'

    There are no other elements with the id or name as 'BirthMonth' so I am a little confused why it is not seeing it as a select tag


Comments

  • Registered Users, Registered Users 2 Posts: 6,737 ✭✭✭DaireQuinlan


    you should get familiar with the development tools of whatever browser you're using. What makes you think it's a select ?

    This is it in its unexpanded form (with lots of attributes elided)

    <span id="BirthMonth">
      <div class="goog-inline-block goog-flat-menu-button jfk-select" title="Birthday" style="-webkit-user-select: none;">
        <div class="goog-inline-block goog-flat-menu-button-caption" id=":0">
               Month
        </div>
        <div class="goog-inline-block goog-flat-menu-button-dropdown" >&nbsp;</div>
      </div><input type="hidden" name="BirthMonth" id="HiddenBirthMonth">
    </span>
    

    expanding it adds a div with the list of months. You'll notice that there's also a hidden field with the name 'BirthMonth' which is probably used to hold the selected value.


  • Registered Users, Registered Users 2 Posts: 3,500 ✭✭✭Drexel


    you should get familiar with the development tools of whatever browser you're using. What makes you think it's a select ?

    This is it in its unexpanded form (with lots of attributes elided)

    <span id="BirthMonth">
      <div class="goog-inline-block goog-flat-menu-button jfk-select" title="Birthday" style="-webkit-user-select: none;">
        <div class="goog-inline-block goog-flat-menu-button-caption" id=":0">
               Month
        </div>
        <div class="goog-inline-block goog-flat-menu-button-dropdown" >&nbsp;</div>
      </div><input type="hidden" name="BirthMonth" id="HiddenBirthMonth">
    </span>
    

    expanding it adds a div with the list of months. You'll notice that there's also a hidden field with the name 'BirthMonth' which is probably used to hold the selected value.

    Thanks for the reply. I dunno how I missed expanding it. Got it working straight after I noticed


Advertisement