Datetime and range slider tools for python selenium
Project description
Selenium-Tools provides the following tools for use with Selenium:
- Send/receive
datetime.datetimeobjects from web forms. - Drag range sliders to specified values.
Installation
$ pip install selenium-tools
Quickstart
First, clone an example file from the Selenium-Tools repo.
$ curl https://raw.githubusercontent.com/dsbowen/selenium-tools/master/form.html --output form.html
Let's send the current date and time to all input in the form.
from selenium_tools import get_datetime, 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_)
print(get_datetime(
input_.get_attribute('type'),
input_.get_property('value')
))
You'll see the form filled in in your selenium browser and receive the following output in your terminal:
2020-06-30 00:00:00
2020-06-30 15:47:00
2020-06-01 00:00:00
1900-01-01 15:47:00
2020-01-01 00:00:00
We can also drag the range slider as follows:
from selenium_tools import drag_range
range_ = driver.find_element_by_css_selector('input[type=range]')
drag_range(driver, range_, 80)
range_.get_property('value')
Out:
'80'
Citation
@software{bowen2020selenium-tools,
author = {Dillon Bowen},
title = {Selenium-Tools},
url = {https://dsbowen.github.io/selenium-tools/},
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file selenium-tools-0.0.2.tar.gz.
File metadata
- Download URL: selenium-tools-0.0.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8463c4e8ff4e98d4da04592bf4cf84e5da5a2d1c29cb4a7189744ecd0c41439
|
|
| MD5 |
467439e129681a9d9c988527487ffb38
|
|
| BLAKE2b-256 |
0b599ba8753125ce78683310a07fb2157c59c6fa8d6c84aa38dede81d2556eaf
|
File details
Details for the file selenium_tools-0.0.2-py3-none-any.whl.
File metadata
- Download URL: selenium_tools-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa860baf1dd173bb28d6c472156afd41e42e48643cdde67bff501d998a782f51
|
|
| MD5 |
1807aa61ecba8bc440fc7966397e23bf
|
|
| BLAKE2b-256 |
4afa31541299679dd8ec6ff392523a9277791dfe813404546e4484151323a2d1
|