After a bit of research I have got to this point:
If I use firefox and send_keys('2020-02-05') to an element(see below) it goes through.
If I use Chromedriver then it does not.
Element:
<input name="" value="" id="was-returns-reconciliation-report-start-date" type="date" class="was-form-control was-input-date" data-defaultdate="" data-mindate="" data-maxdate="today" data-placeholder="Start Date" max="2020-02-12">
Found this link, even though it doesn't seem that related. send_keys() issue on github
The last answer got me back to try and use the following:
driver.execute_script("document.getElementById('was-returns-reconciliation-report-start-date').valueAsDate = new Date().toISOString();")
I don't know how to enter the date in the above code.
I get the following error:
Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 3291, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in driver.execute_script("document.getElementById('was-returns-reconciliation-report-start-date').valueAsDate = new Date().toISOString();") File "/home/xxx/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_script 'args': converted_args})['value'] File "/home/xxx/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/xxx/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to set the 'valueAsDate' property on 'HTMLInputElement': The provided value is not a Date. (Session info: chrome=71.0.3578.98) (Driver info: chromedriver=71.0.3578.98,platform=Linux 4.15.0-45-generic x86_64)
Can someone please help me to figure out how to set the date in the element?
I have been trying for hours now. I can do it in firefox but there is an issue with downloading files in firefox(pop-up will not open in the same window and then the dialog box pops up).
TIA