from selenium import webdriver
from time import sleep
driver = webdriver.Firefox()
driver.get('http://www.sucaijiayuan.com/api/demo.php?url=/demo/20141108-1/')
driver.switch_to.frame('iframe')#情提醒一下:注意时刻提防iframe!
# js = "document.getElementById('txtBeginDate').removeAttribute('readonly')"
# 1.原生js,移除属性 # js = "$('input[id=txtBeginDate]').removeAttr('readonly')"
# 2.jQuery,移除属性 # js = "$('input[id=txtBeginDate]').attr('readonly',false)"
# 3.jQuery,设置为false js = "$('input[id=txtBeginDate]').attr('readonly','')"
# 4.jQuery,设置为空(同3) driver.execute_script(js) driver.find_element_by_id('txtBeginDate').send_keys('2016-08-24')
sleep(2)
print driver.find_element_by_id('txtBeginDate').get_attribute('value')
driver.quit()