Skip to main content

Automation Library

Project description

This is an image

selenium pro - intelligent & powerful cloud native selenium

PyPI version

Benefits of selenium-pro over selenium

  • All the capabilities of Selenium +
  • Auto write scripts using Selenium Script Generator
  • No Inspection of HTML Elements required
  • Intelligent Element Handling Automatically in case of HTML changes
  • Auto Setup Chromedrivers based on Operating System & Browser versions
  • Run scripts in Cloud with single function call
  • Bypass Automated Browser Detection
  • Coming Up - Convert your old selenium scripts to selenium pro so that they never fail due to element errors

Selenium Pro Auto Code Generator Chrome Extension

Installation

pip install selenium-pro

Import

from selenium_pro.webdriver.common.keys import Keys
from selenium_pro import webdriver

Start Browser

driver = webdriver.Start()

Example 1

It searches a keyword on google

from selenium_pro.webdriver.common.keys import Keys
from selenium_pro import webdriver

driver = webdriver.Start()

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

#click on searh bar with find pro
driver.find_element_by_pro('QYQyyPtidm5_xqG').click()

driver.switch_to.active_element.send_keys('shoes\n')

# scrape result count with pro
result_count=driver.find_element_by_pro('z6XMV66vxokYpfn').text
print('result_count ',result_count)

driver.quit()

Example 2

It fetches the titles of packages on pypi

from selenium_pro.webdriver.common.keys import Keys
from selenium_pro import webdriver

driver = webdriver.Start()

driver.get("https://pypi.org/search/?q=firebase")
title_elements=driver.find_elements_by_pro("ErZwU_jOEg0s4_9")
for ele in title_elements:
	print(ele.text)
driver.quit()

Find Elements By Pro

  • This is one of the advanced methods added in this library aside from the conventional methods in selenium.
  • This method finds element without you having to mention selectors or locators
  • Also this ensures that whenever HTML element changes, its able to adapt to changes & work fine without you having to do any code change
  • Use this Selenium Pro Auto Code Generator Chrome Extension to get pro-id for any element on the web

Webdriver-Start

  • This method will check your operating system, default browser & its version & install driver accordingly
  • You can still use conventional methods if you want specific configuration

All Default Selenium Functions Work Well

#find elements by conventional methods
driver.find_elements(By.XPATH, '//button')

#close window
driver.close()

#set cookies in browser
driver.add_cookie({})

....

All your selenium scripts will work fine with selenium pro. Just import selenium pro instead

#from selenium import webdriver
from selenium_pro import webdriver
#from selenium.webdriver.support.ui import WebDriverWait
from selenium_pro.webdriver.support.ui import WebDriverWait


# Step 1) Open Firefox 
browser = webdriver.Firefox()
# Step 2) Navigate to Facebook
browser.get("http://www.facebook.com")
# Step 3) Search & Enter the Email or Phone field & Enter Password
username = browser.find_element_by_id("email")
password = browser.find_element_by_id("pass")
submit   = browser.find_element_by_id("loginbutton")
username.send_keys("YOUR EMAILID")
password.send_keys("YOUR PASSWORD")
# Step 4) Click Login
submit.click()
wait = WebDriverWait( browser, 5 )
page_title = browser.title
assert page_title == "Facebook"

Intermix Advanced & Conventional Methods

Below code searches keyword on pypi & scrapes few details of package

from selenium_pro.webdriver.common.keys import Keys
from selenium_pro import webdriver

driver = webdriver.Start()

driver.get("https://pypi.org")
driver.find_element_by_id('search').click()
driver.switch_to.active_element.send_keys('datakund\n')

# Advanced method to click on 1st item in search results
driver.find_element_by_pro('NEHC72vwdxktcm5').click()

# Conventional method to scrape title
title=driver.find_element_by_class_name('package-header__name').text
print('title ',title)

# Advanced method to scrape release_date
release_date=driver.find_element_by_pro('STT9vQuCT0fdEdq').text
print('release_date ',release_date)

# Advanced method to scrape author
author=driver.find_element_by_pro('gsANAnAvkCt7_aM').text
print('author ',author)

# Conventional method to scrape description
description=driver.find_element_by_class_name('package-description__summary').text
print('description ',description)

driver.quit()

Complete Selenium Documentation Available here

Selenium Python Docs

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

selenium_pro-1.0.9.tar.gz (826.1 kB view hashes)

Uploaded source

Supported by

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