This is my first question in OS and I would describe it in details with my best effort.
Selenium3.0.2
firefox 45.6.0
geckodriver 0.13.0
python 3.5.1 (with Anaconda 2.4.1 (64bit))
What I want to do is to automate the process of registering a new facebook account. The below code can set values in boxes such as "first name" and "password".
However, it cannot make any selection from the drop down list, such "day", "month", or "year"
# -*- coding: utf-8 -*-
import selenium
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
from datetime import datetime
import unittest, time, re
browser = webdriver.Firefox()
browser.get('https://www.facebook.com')
browser.maximize_window()
browser.find_element_by_id("u_0_1").send_keys("firstName")
time.sleep(2)
browser.find_element_by_id("u_0_3").send_keys("lastName")
time.sleep(2)
browser.find_element_by_id("u_0_5").send_keys("[email protected]")
time.sleep(2)
browser.find_element_by_id("u_0_8").send_keys("[email protected]")
time.sleep(2)
browser.find_element_by_id("u_0_a").send_keys("testpassword")
time.sleep(2)
Select(browser.find_element_by_id("month")).select_by_visible_text("Jan")
time.sleep(2)
Select(browser.find_element_by_id("month")).select_by_visible_text("Feb")
time.sleep(2)
Select(browser.find_element_by_id("month")).select_by_visible_text("Apr")
time.sleep(2)
Select(browser.find_element_by_id("month")).select_by_visible_text("Dec")
time.sleep(2)
Select(browser.find_element_by_id("day")).select_by_visible_text("1")
time.sleep(2)
Select(browser.find_element_by_id("day")).select_by_visible_text("7")
time.sleep(2)
Select(browser.find_element_by_id("day")).select_by_visible_text("11")
time.sleep(2)
Select(browser.find_element_by_id("day")).select_by_visible_text("28")
time.sleep(2)
Select(browser.find_element_by_id("year")).select_by_visible_text("1990")
time.sleep(2)
Select(browser.find_element_by_id("year")).select_by_visible_text("1991")
time.sleep(2)
Select(browser.find_element_by_id("year")).select_by_visible_text("1992")
time.sleep(2)
Select(browser.find_element_by_id("year")).select_by_visible_text("1993")
time.sleep(2)
#select gender
browser.find_element_by_id("u_0_i").click()