Skip to main content

Xpath Wrapper


Selenium xpath wrapper framework
Selenium Xpath wrapper , support browsers Chrome, Firefox, Supported OS Windows, Linux, Ubuntu, Mac

Examples :

To Use Chrome Browser :

from xpathwrapper.basec import driver,checkbyxpath

driver.get('http://testing.pythonautomation.tk/')

checkbyxpath("//ul[@class='actions']//li/a[text()='Test Me']").click()

To Use Firefox Browser :

from xpathwrapper.basec import driver,checkbyxpath

driver.get('http://testing.pythonautomation.tk/')

checkbyxpath("//ul[@class='actions']//li/a[text()='Test Me']").click()

.................................... Key Words ..........................

checkbyid(locator):

"""
checkbyid(locator)

Locating by Id; Use this when you know id attribute of an element. With this strategy, 
the first element with the id attribute value matching the location will be returned.
If no element has a matching id attribute, a NoSuchElementException will be raised..

checkbyid('loginForm')

"""
driver.find_element_by_id(locator)

checkbyname(locator):

"""
checkbyname(locator)

Locating by Name; Use this when you know name attribute of an element. With this strategy,
 the first element with the name attribute value matching the location will be returned. 
 If no element has a matching name attribute, a NoSuchElementException will be raised. 

checkbyname('username')

"""
driver.find_element_by_name(locator)

checkbyxpath(locator):

"""
checkbyxpath(locator)

Locating by XPath; XPath is the language used for locating nodes in an XML document. As HTML can 
be an implementation of XML (XHTML), Selenium users can leverage this powerful language to target 
elements in their web applications. XPath extends beyond (as well as supporting) the simple methods 
of locating by id or name attributes, and opens up all sorts of new possibilities such as locating 
the third checkbox on the page.

One of the main reasons for using XPath is when you don't have a suitable id or name attribute for 
the element you wish to locate. You can use XPath to either locate the element in absolute terms 
(not advised), or relative to an element that does have an id or name attribute. XPath locators can 
also be used to specify elements via attributes other than id and name.

Absolute XPaths contain the location of all elements from the root (html) and as a result are likely 
to fail with only the slightest adjustment to the application. By finding a nearby element with an id 
or name attribute (ideally a parent element) you can locate your target element based on the 
relationship. This is much less likely to change and can make your tests more robust. 

checkbyxpath('/html/body/form[1]')

"""
driver.find_element_by_xpath(locator)

checkbylinktext(locator):

"""
checkbylinktext(locator)

Locating Hyperlinks by Link Text; Use this when you know link text used within an anchor tag. 
With this strategy, the first element with the link text value matching the location will be 
returned. If no element has a matching link text attribute, a NoSuchElementException will be raised.

checkbylinktext('Continue')

"""
driver.find_element_by_link_text(locator)

checkbypartialtext(locator):

"""
checkbypartialtext(locator)

findFileByName; Search the file by using name of the file in directory.
Once using name indicates the file name and path indicates the directory where
you want to search. 

checkbypartialtext('Conti')

"""
driver.find_element_by_partial_link_text(locator)

checkbytag(locator):

"""
checkbytag(locator)

Locating Elements by Tag Name; Use this when you want to locate an element by tag name. 
With this strategy, the first element with the given tag name will be returned. If no 
element has a matching tag name, a NoSuchElementException will be raised.

checkbytag('h1')

"""
driver.find_element_by_tag_name(locator)

checkbyclass(locator):

"""
checkbyclass(locator)

Locating Elements by Class Name; Use this when you want to locate an element by class 
attribute name. With this strategy, the first element with the matching class attribute 
name will be returned. If no element has a matching class attribute name, a 
NoSuchElementException will be raised. 

checkbyclass('content')

"""
driver.find_element_by_class_name(locator)

checkbycss(locator):

"""
checkbycss(locator)

Locating Elements by CSS Selectors; Use this when you want to locate an element by CSS selector
syntax. With this strategy, the first element with the matching CSS selector will be returned.
If no element has a matching CSS selector, a NoSuchElementException will be raised. 

checkbycss('p.content')

"""
driver.find_element_by_css_selector(locator)

checkbynames(locator):

"""
checkbynames(locator)

Locating by Name; Use this when you know name attribute of an element. With this strategy,
the first element with the name attribute value matching the location will be returned. 
If no element has a matching name attribute, a NoSuchElementException will be raised. 

checkbynames('username')

"""
driver.find_elements_by_name(locator)

checkxpathelements(locator):

"""
checkxpathelements(locator)

Locating by XPath; XPath is the language used for locating nodes in an XML document. As HTML can 
be an implementation of XML (XHTML), Selenium users can leverage this powerful language to target 
elements in their web applications. XPath extends beyond (as well as supporting) the simple methods 
of locating by id or name attributes, and opens up all sorts of new possibilities such as locating 
the third checkbox on the page.

One of the main reasons for using XPath is when you don't have a suitable id or name attribute for 
the element you wish to locate. You can use XPath to either locate the element in absolute terms 
(not advised), or relative to an element that does have an id or name attribute. XPath locators can 
also be used to specify elements via attributes other than id and name.

Absolute XPaths contain the location of all elements from the root (html) and as a result are likely 
to fail with only the slightest adjustment to the application. By finding a nearby element with an id 
or name attribute (ideally a parent element) you can locate your target element based on the 
relationship. This is much less likely to change and can make your tests more robust. 

checkxpathelements('/html/body/form[1]')

"""
driver.find_elements_by_xpath(locator)

checkbylinktexts(locator):

"""
checkbylinktexts(locator)

Locating Hyperlinks by Link Text; Use this when you know link text used within an anchor tag. 
With this strategy, the first element with the link text value matching the location will be 
returned. If no element has a matching link text attribute, a NoSuchElementException will be raised.

checkbylinktexts('Continue')

"""
driver.find_elements_by_link_text(locator)

checkbypartialtexts(locator):

"""
checkbypartialtexts(locator)

findFileByName; Search the file by using name of the file in directory.
Once using name indicates the file name and path indicates the directory where
you want to search. 

checkbypartialtexts('Conti')

"""
driver.find_elements_by_partial_link_text(locator)

checkbytagelements(locator):

"""
checkbytagelements(locator)

Locating Elements by Tag Name; Use this when you want to locate an element by tag name. 
With this strategy, the first element with the given tag name will be returned. If no 
element has a matching tag name, a NoSuchElementException will be raised.

checkbytagelements('h1')

"""
driver.find_elements_by_tag_name(locator)

checkbyclassnames(locator):

"""
checkbyclassnames(locator)

Locating Elements by Class Name; Use this when you want to locate an element by class 
attribute name. With this strategy, the first element with the matching class attribute 
name will be returned. If no element has a matching class attribute name, a 
NoSuchElementException will be raised. 

checkbyclassnames('content')

"""
driver.find_elements_by_class_name(locator)

checkbycssselectors(locator):

"""
checkbycssselectors(locator)

Locating Elements by CSS Selectors; Use this when you want to locate an element by CSS selector
syntax. With this strategy, the first element with the matching CSS selector will be returned.
If no element has a matching CSS selector, a NoSuchElementException will be raised. 

checkbycssselectors('p.content')

"""
driver.find_elements_by_css_selector(locator)

Metadata

Release files for xpathwrapper 1.1

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

Source distribution (sdist)

Source distribution for xpathwrapper 1.1
File Size Uploaded Provenance Actions
xpathwrapper-1.1.tar.gz 5.3 kB Without provenance Details for xpathwrapper-1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xpathwrapper 1.1
File Interpreter ABI Platform Actions
xpathwrapper-1.1-py3-none-any.whl Python 3 none any Details for xpathwrapper-1.1-py3-none-any.whl

Total release size: 15.3 kB

Release files / xpathwrapper-1.1.tar.gz

Download URL xpathwrapper-1.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7e58f24197ac810a49a5da34f383d0c7d7eb40fa1866c48348ac50fcce3fe3dc
BLAKE2b-256 checksum
How to use checksums
f58ac4beaf6d4988fe397e6cdf9a51661625391eb74b0f036e7b78c6e6318a4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.4

Release files / xpathwrapper-1.1-py3-none-any.whl

Download URL xpathwrapper-1.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e251382da2d712cecb71b20092df75b5522a901df348012522102a98fe1cbf7
BLAKE2b-256 checksum
How to use checksums
9ee56faf75836a393c890805f01c5a178cb9e9c2067e05c8cfa61f56a49f7b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.4

Security for xpathwrapper 1.1

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.1 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