how to input datetime in a html form with robotframework / selenium2library?

230 views Asked by At

I am trying to enter a date to a datetime picker with a robot framework test using the "press keys" keyword, but when it finishes including said string the datetime restarts. What could I do to make the datetime keep the entered data?

This is the code I am using:

Robot Framework

*** Settings ***
Documentation  Ptest
Library  Selenium2Library
*** Variables ***


*** Test Cases ***
     Select a date from datepicker of material-ui library
     Open Browser  http://127.0.0.1:5500/pb.html  Chrome
     Wait Until Element Is Visible    id:party 
     Press Keys     id:party    240120310959

*** Keywords ***

HTML Code

<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>test</title>
</head>
<body>
 <form action="pb.html" method="post">
  <label for="party">Enter a date and time for your party booking:</label><br />
  <input
    id="party"
    type="datetime-local"
    name="partydate"
  /><br />
  
</form>
</body>
</html>
0

There are 0 answers