zoukankan      html  css  js  c++  java
  • python selenium 处理时间日期控件

    # -*- 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
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    bzoj3996
    bzoj3157 3516
    bzoj1937
    bzoj1532
    bzoj3572
    bzoj1453
    bzoj3205
    bzoj2595
    关于高斯消元解决xor问题的总结
    linux查找和替换命令
  • 原文地址:https://www.cnblogs.com/51testing/p/11258812.html
Copyright © 2011-2022 走看看