Skip to main content

Selenium Element Finder Library

Project description

Installation

pip install element-manager

Import

from element_manager import get_xpath

Selenium Auto Code Generator Chrome Extension

  • Install the extension in your browser
  • Start Recording your actions like
    • Open Url
    • Click
    • Type
    • Scrape (right click on element & use scrape option)
    • etc.
  • Selenium code with Element Manager will be generated automatically
  • Copy it & run in your python shell

Example

Below script searches given keyword on google & scrapes result count

from selenium import webdriver
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from element_manager import *
driver = webdriver.Chrome(ChromeDriverManager().install())

# Open URL
driver.get('https://www.google.com/')

#Click on Search bar
driver.find_element(By.XPATH,get_xpath(driver,'QYQyyPtidm5_xqG')).click()

# Type in search bar
driver.switch_to.active_element.send_keys('shoes\n')

# Scrape result count
result_count=driver.find_element(By.XPATH,get_xpath(driver,'z6XMV66vxokYpfn')).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 Distribution

element_manager-1.0.4.tar.gz (10.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page