Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Selenium select

Options
  • 17-06-2016 11:14am
    #1
    Registered Users 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 Posts: 6,676 ✭✭✭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 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