Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

elements_manager-1.0.2-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page