Skip to main content

logo Library that helps you with storing ui elements in files

HOWTO Install:

  • pip install ui-map-parser

HOWTO Use:

First you should create a folder where you will store ini files with selectors. In this folder create common.ini file. Now you can create elements in this file or create another ini files which will represent pages.

Example of common.ini:

[DEFAULT]
type=xpath

[SimpleXpathElement]
selector=//div

[SimpleCssElement]
type=css
selector=div#some-id

Example of how you can access this elements:

from ui_map_parser import UIMapParser

# common is page by default but you can change it specifying default_page variable during initialization
ui_map_parser = UIMapParser(ini_files_folder)
selector_type, selector = ui_map_parser.parse_element('SimpleXpathElement')  # name of element is case insensitive
# selector_type will be equal to "xpath", selector will be equal to "//div"

You can add another page for example login.ini:

[DEFAULT]
type=xpath

[EmailTextField]
selector=//div[@id="login-panel"]/input[@id="email"]

[PasswordTextField]
selector=//div[@id="login-panel"]/input[@id="password"]

and then access it in following way:

selector_type, selector = ui_map_parser.parse_element('Login.EmailTextField')

You can replace repeating sections such as "//div[[@id="login-panel"]" by using "parent" property:

[DEFAULT]
type=xpath

[LoginPanel]
selector=//div[@id="login-panel"]

[EmailTextField]
parent=Login.LoginPanel
selector=/input[@id="email"]

[PasswordTextField]
parent=Login.LoginPanel
selector=/input[@id="password"]

parent=Login.LoginPanel indicates that we are searching for parent element in login.ini file with name "LoginPanel". In case if parent element located in "default_page" (common.ini by default) you can skip this and use without specifying page parent=LoginPanel.

Important note: you can use parent only on elements with same type

To work with more complex elements templates are supported, you can specify template in your selector:

[RegionButtonTemplate]
type=xpath
selector=//input[@id="region-%%region%%-button"]

and then use it like:

selector_type, selector = ui_map_parser.parse_element('Login.RegionButtonTemplate', template={'region': 'na'})
# selector will be equal to "//input[@id="region-na-button"]"

Also you can specify selectors for different languages:

[SomeElement]
type=xpath
selector=//div
en=[text()="some en text"]
es=[text()="some es text"]

and then specify language when initializing UIMapParser:

ui_map_parser = UIMapParser(ini_files_folder, language='en')
selector_type, selector = ui_map_parser.parse_element('SomeElement')
# selector will be equal to "//div[text()="some en text"]"

Metadata

Release files for ui-map-parser 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ui-map-parser 1.0.0
File Size Uploaded Provenance Actions
ui-map-parser-1.0.0.tar.gz 9.2 kB Without provenance Details for ui-map-parser-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ui-map-parser 1.0.0
File Interpreter ABI Platform Actions
ui_map_parser-1.0.0-py3-none-any.whl Python 3 none any Details for ui_map_parser-1.0.0-py3-none-any.whl

Total release size: 19.5 kB

Release files / ui-map-parser-1.0.0.tar.gz

Download URL ui-map-parser-1.0.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
645704095c3fb055e8e4193207c0a351c82e54993be05ab1e07a16bac97d0694
BLAKE2b-256 checksum
How to use checksums
e6db18ac6271677339b1914529e88119ca9dc417e0d32ea212239165b91bd2f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Release files / ui_map_parser-1.0.0-py3-none-any.whl

Download URL ui_map_parser-1.0.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27e1af52fd725baaaecd7734b16f5f24fbc1e3e8f8dd9dfded129d8b95f2dd16
BLAKE2b-256 checksum
How to use checksums
828998f132c9649e7552ccc7b1f05051d932242ddeda0f640c9a41bb106fc10f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Security for ui-map-parser 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page