Selenium Element Finder Library
Project description
Installation
pip install elements-manager
Import
from elements_manager import get_xpath
Example
Below script searches given keyword on google & scrapes result count
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from elements_manager import get_xpath
driver = webdriver.Chrome("chromedriver.exe")
# Open URL
driver.get('https://www.google.com/')
xpath=get_xpath(driver,'QYQyyPtidm5_xqG')
driver.find_element_by_xpath(xpath).click()
# Type in search bar
driver.switch_to.active_element.send_keys('shoes\n')
# Advanced method to scrape result count
xpath=get_xpath(driver,'z6XMV66vxokYpfn')
result_count=driver.find_element_by_xpath(xpath).text
print('result_count ',result_count)
driver.quit()
Contact Us
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
elements_manager-1.0.1.tar.gz
(9.6 kB
view hashes)
Built Distribution
Close
Hashes for elements_manager-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dd3fe69f75c5a322ae4b5781d6f58aaf4dd1537f07907e1663eee62d5d723e3 |
|
MD5 | c2d2f145bcdd71d5f81710dd40c50794 |
|
BLAKE2b-256 | 05340d58a0670989205cc287c52e157678d57eb27246a9b6498e106bd16d4307 |