Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:
class SignUpPage(AbstractPage):
    def __init__(self, driver):
        super(SignUpPage, self).__init__(driver)

    def open_sign_up_page(self):
        self.driver.find_element_by_css_selector('a.home-button.js-popup-link').click()
        return SignUpPage(self.driver)

    def sign_up(self, first_name, last_name, email, req_password, school_name, city_name):
        self.driver.find_element_by_id('moderator_first_name').send_keys(first_name)
        self.driver.find_element_by_id('moderator_last_name').send_keys(last_name)
        self.driver.find_element_by_id('moderator_email').send_keys(email)
        self.driver.find_element_by_id('moderator_password').send_keys(req_password)
        self.driver.find_element_by_id('moderator_password_confirmation').send_keys(req_password)
        self.driver.find_element_by_id('moderator_school_attributes_name').send_keys(school_name)
        self.driver.find_element_by_id('moderator_school_attributes_city').send_keys(city_name)
        **Select(self.driver.find_element_by_xpath('//*[@id="moderator_school_attributes_state"]')).select_by_visible_text('Alabama')**
        self.driver.find_element_by_xpath('//*[@id="new_moderator"]/div[8]/input').click()
        return PostSignUpPage(self.driver)

This is my form filling 'script' ,

http://screencast.com/t/ofjvjgwH7 -> source code for select.

I tried locating the select item with xpath, id, css-locator, name attribute, none of them worked. The error I get goes as follows

File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 181, in check_response raise exception_class(message, screen, stacktrace) ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with Stacktrace:

share|improve this question
    
I have all the imports on top, did not put them in code, considered unnecessary. ** - ** - is the line I am having problem with. – Maciej Kownacki Dec 2 at 14:17
    
Implement some wait to load page fully.. – SIslam Dec 2 at 14:18

Try

driver.find_element_by_xpath('//select[@class="select"]/option[@value="Alabama"]').click()
share|improve this answer
    
does not work, I am pasting more source code, screencast.com/t/LBdgl9Yts7Lp – Maciej Kownacki Dec 2 at 15:17
    
try first call drop-down menu driver.find_element_by_xpath('//select[@class="select"]').click() and then choose option driver.find_element_by_xpath('//option[@value="Alabama"]').click() – Andersson Dec 2 at 16:02
    
Please consider editing your post to add more explanation about what your code does and why it will solve the problem. An answer that mostly just contains code (even if it's working) usually wont help the OP to understand their problem. It's also recommended that you don't post an answer if it's just a guess. A good answer will have a plausible reason for why it could solve the OP's issue. – SuperBiasedMan Dec 2 at 16:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.