Selenium automation processing of calendar or date control for non-input boxes

share picture

share picture

Share pictures

4, at this time we can remove the readonly attribute, the problem is easily solved, the code is as follows:


  String js
= "document.getElementById('createTime').removeAttribute('readonly')"; // Native js, remove attributes

((JavascriptExecutor)driver).executeScript(js);
// Force driver to JavascriptExecutor type

  driver.findElement(By.id(
"createTime")).sendKeys("2016-08-24"); //Enter the date


5, you must remember to import this method in the code:

import org.openqa.selenium.JavascriptExecutor;

4, at this time we can remove the readonly attribute, the problem is easily solved, the code is as follows:


  String js
= "document.getElementById('createTime').removeAttribute('readonly')"; // Native js, remove attributes

((JavascriptExecutor)driver).executeScript(js);
// Force driver to JavascriptExecutor type

  driver.findElement(By.id(
"createTime")).sendKeys("2016-08-24"); //Enter the date


5, you must remember to import this method in the code:

import org.openqa.selenium.JavascriptExecutor;

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2229 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.