How the date control is handled when writing scripts in the Python language

Source: Internet
Author: User

In the date control, the input control of the date control is generally not entered manually; just remove the ReadOnly attribute.

Actually very simple, we do not make time date space, we treat it as a normal input box to deal with it!

However, a lot of this type of input box is forbidden to enter manually, what to do?

Very simple, with JS to prohibit the input of the ReadOnly attribute removed just fine. Here are four ways to

#-*-coding:utf-8-*-from Selenium Import webdriverfrom time Import sleepdriver = 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. Native JS, remove attributes# js =  "$ (' input[id=txtbegindate] '). Removeattr (' readonly ')" Span class= "Hljs-array" ># 2.jquery, removing properties # js = " $ (' input[id=txtbegindate] '). attr (' readonly ', False) "# 3.jquery, set to Falsejs =  "$ (' input[id=txtbegindate] '). attr (' ReadOnly ', ') "# 4.jquery, set to empty (same as  ' 2016-08-24 ') sleep (2) print driver.find_element_by_id ( Txtbegindate '). Get_attribute ( ' value ') driver.quit ()   

Original article Address: http://www.infocool.net/kb/Python/201608/184024.html

How the date control is handled when writing scripts in the Python language

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.