# -*- coding: utf-8 -*-
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')
# 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()
---------------------
作者:huilan_same
来源:CSDN
原文:https://blog.csdn.net/huilan_same/article/details/52385401
版权声明:本文为博主原创文章,转载请附上博文链接!