Selenium extension
Project description
https://setuptools.readthedocs.io/en/latest/setuptools.html#develop-deploy-the-project-source-in-development-mode https://github.com/navdeep-G/setup.py
python setup.py develop
url = 'https://www.google.com'
# 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.
ws.setup_driver()
# 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')
ws.driver.get(url)
# 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")
search_btn.click()
# Shortened Webdriver wait class.
ws.wait().until(EC.title_contains("Hello World"))
# Quickly grab all the unique links from a webpage
ws.get_all_unique_links()
# Js Functions
ws.js_scroll_to_bottom()
element = ws.driver.find_element_by_name('g')
ws.js_scroll_into_view(element)
# Save a screenshot, by default will take the page title name as filename
ws.save_screenshot()
# Or pass it a filename
ws.save_screenshot("Googlesearchresults")
# Returns various info about the driver and page.
ws.get_info()
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
seleniumx-0.1.1.tar.gz
(9.2 kB
view details)
Built Distribution
File details
Details for the file seleniumx-0.1.1.tar.gz
.
File metadata
- Download URL: seleniumx-0.1.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dc57b47e45b484787fe9befbb20ce561d8ecbceed82e27d3bc2c5cbe625f767 |
|
MD5 | d504c55d9fea29001eda19e5802ba648 |
|
BLAKE2b-256 | 3cf0bcb8565ef4cdaf1dc1886a552e36b7090c0c515a7722e9df20c3afd254da |
File details
Details for the file seleniumx-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: seleniumx-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aeb0a2455c3b0002edd54e5defbb58c01c841dbdb84e6de9c0e24240c4135de |
|
MD5 | 1873816c5eac7c02398fedb849cad2e4 |
|
BLAKE2b-256 | f555c7990ddac7695df16b2b39abc4d2b6a5a7cc027d6d6e3cfb32e6813ed04a |