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