Skip to main content

Selenium extension

Project description

python develop

url = ''

# Instantiate the class which wraps selenium webdriver base class, with an event listener for debugging
# and an automatic webdriver manager
ws = WebScraper()
# Setup_driver takes care of downloading the latest chrome binary. You must call this to start the chrome browser.
# By default, setup_driver will look for the path to the chrome binary first in an environment variable CHROMEDRIVER_PATH
# This variable is specific to Heroku deployments. If that is not set, it will download the
# latest chrome binary and save it to the project root directory.
# The browser will also not be headless.

# To override the defaults simply pass it keyword arguments.
# ws.setup_driver(chrome_driver_path='/absolute/path/to/a/directory/to/save/chromedriver/in',
#                 headless=True,
#                 version="2.26")

# If you want to setup a driver the old fashioned way, then you can point to an already installed version of chromedriver to use
# ws.setup_driver(chrome_driver_bin='/absolute/path/to/a/directory/to/save/chromedriver/in/chromedriver')

# ws.setup_driver(chrome_driver_bin='/Users/home/PycharmProjects/seleniumX/seleniumX/drivers/drivers/chromedriver/2.26/mac64/chromedriver')

# Avoid bot detections
ws.random_sleep()  # Default is 5 - 10 seconds
ws.random_sleep(sleep_range=(1, 2))  # or you can pass a tuple of a different range.

# Access the driver like normal.
element = ws.driver.find_element_by_name("q")

# Use random key inputs to prevent bot detection
ws.random_send_keys("Hello World", element)
# lucky_btn = ws.driver.find_element_by_name("btnI")
search_btn = ws.driver.find_element_by_name("btnK")

# Shortened Webdriver wait class.
ws.wait().until(EC.title_contains("Hello World"))

# Quickly grab all the unique links from a webpage

# Js Functions
element = ws.driver.find_element_by_name('g')

# Save a screenshot, by default will take the page title name as filename
# Or pass it a filename

# Returns various info about the driver and page.

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

seleniumx-0.1.1.tar.gz (9.2 kB view hashes)

Uploaded source

Built Distribution

seleniumx-0.1.1-py3-none-any.whl (9.5 kB view hashes)

Uploaded py3

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