Selenium Webdriver processing-Assigning a value to a text box through a time control

Source: Internet
Author: User

Note: Most programs select time by selecting a date directly from the time control and assigning it to a text box, as illustrated below

1, the use of time control to assign values to the text box specific examples are as follows:

HTML interface:

Java code:

Use JS to remove the input tag readonly the   String js1= "var Setdate=document.getelementbyid (\" publishtime\ "); Setdate.removeattribute (' readonly '); /define a JS   Exejs (DR, js1);//execute JS   webelement s_p_fbsj=ffind (DR, By.id ("Publishtime"));//Get the time corresponding to the text box   S_p_ Fbsj.clear ();   S_p_fbsj.sendkeys (Demo.getexcel (index, one, colnum));//When you read a value from Excel, you format the table as text in Excel, or you read a number   Webelement Dayelement=ffind (DR, By.xpath ("//*[@id = ' ui-datepicker-div ']/div[3]/button[2]"));//Get the OK button   on the time control Dayelement.click ();//Click the OK button to close the time control

  

Selenium Webdriver processing-Assigning a value to a text box through a time control

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.