Send and receive datetime objects from web forms.
Project description
Datetime-Selenium allows you to send/retrieve datetime.datetime
objects to/from web forms using Selenium.
Installation
$ pip install datetime-selenium
Quickstart
First, clone an example file from the Datetime-Selenium repo.
$ curl https://raw.githubusercontent.com/dsbowen/datetime-selenium/master/form.html --output form.html
Let's send the current date and time to all input in the form.
from datetime_selenium import send_datetime
from selenium.webdriver import Chrome
from datetime import datetime
driver = Chrome()
driver.get('data:text/html,'+open('form.html').read())
datetime_ = datetime.utcnow()
css_selectors = (
'input[type=date]',
'input[type=datetime-local]',
'input[type=month]',
'input[type=time]',
'input[type=week]'
)
for selector in css_selectors:
input_ = driver.find_element_by_css_selector(selector)
send_datetime(input_, datetime_)
You'll see the form filled in in your selenium browser.
Citation
@software{bowen2020datetime-selenium,
author = {Dillon Bowen},
title = {Datetime-Selenium},
url = {https://dsbowen.github.io/datetime-selenium/},
date = {2020-06-29},
}
License
Users must cite this package in any publications which use it.
It is licensed with the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for datetime_selenium-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ed25a1b47ef0c4dcbd090657ee9d99f96578ed43f2c6d90c91a07541b22c25d |
|
MD5 | 3441ffd8f0d41a3b56694d3036c1ef94 |
|
BLAKE2b-256 | cfc010660d3a458cb841260280a508d6e3588f1e4db866615e76b292a8738453 |