Merge pull request #188 from seleniumbase/one-top-level-package

Make seleniumbase become the only top-level Python package
This commit is contained in:
Michael Mintz 2018-08-14 02:10:57 -04:00 committed by GitHub
commit d558b9a076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 95 additions and 92 deletions

View File

@ -5,10 +5,10 @@ include .travis.yml
include .gitignore
include requirements.txt
include seleniumbase/core/create_db_tables.sql
include integrations/selenium_grid/grid-hub
include integrations/selenium_grid/grid-node
include integrations/selenium_grid/font_color
include integrations/selenium_grid/start-grid-hub.bat
include integrations/selenium_grid/register-grid-node.bat
include integrations/selenium_grid/start-grid-hub.sh
include integrations/selenium_grid/register-grid-node.sh
include seleniumbase/utilities/selenium_grid/grid-hub
include seleniumbase/utilities/selenium_grid/grid-node
include seleniumbase/utilities/selenium_grid/font_color
include seleniumbase/utilities/selenium_grid/start-grid-hub.bat
include seleniumbase/utilities/selenium_grid/register-grid-node.bat
include seleniumbase/utilities/selenium_grid/start-grid-hub.sh
include seleniumbase/utilities/selenium_grid/register-grid-node.sh

View File

@ -1,4 +1,4 @@
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo4d4.png" title="SeleniumBase" height="58">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo3g.png" title="SeleniumBase" height="50">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="https://img.shields.io/pypi/v/seleniumbase.svg" alt="Version" />](https://pypi.python.org/pypi/seleniumbase) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt="GitHub Stars" />](https://github.com/seleniumbase/SeleniumBase/stargazers) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt="Build Status" />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="Join the Gitter Chat" />](https://gitter.im/seleniumbase/SeleniumBase)<br />
@ -94,7 +94,7 @@ SeleniumBase methods automatically wait for page elements to finish loading befo
SeleniumBase includes an automated/manual hybrid solution called **[MasterQA](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/masterqa/ReadMe.md)**, which speeds up manual testing by having automation perform all the web browser actions while the manual tester only validates what is seen.
**Integrate with your favorite tools:**<br />
SeleniumBase is compatible with [Selenium Grid](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/selenium_grid), [MySQL](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/testcase_manager.py), [Docker](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/docker/ReadMe.md), [NodeJS](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js), [Google Cloud](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/google_cloud/ReadMe.md), and [AWS](#amazon_section).
SeleniumBase is compatible with [Selenium Grid](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_grid), [MySQL](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/testcase_manager.py), [Docker](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/docker/ReadMe.md), [NodeJS](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js), [Google Cloud](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/google_cloud/ReadMe.md), and [AWS](#amazon_section).
**Comes with a business mindset:**<br />
SeleniumBase makes it easy to automate tedious business tasks. (*To learn about businesses using SeleniumBase, [Click Here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/happy_customers.md).*)
@ -106,7 +106,7 @@ SeleniumBase was originally built for [testing HubSpot's platform](https://produ
([Read more about SeleniumBase features here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md))
<a id="seleniumbase_installation"></a>
<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo3d.png" title="SeleniumBase" height="48">
<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo3g.png" title="SeleniumBase" height="48">
## Detailed Instructions:
@ -332,7 +332,7 @@ Here are some things you can do to setup a production environment for your testi
* You can setup a [Jenkins](https://jenkins.io/) build server for running tests at regular intervals. Jenkins has many plugins available, such as [the Xvfb headless browser plugin](https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin) for running tests on a machine with no GUI. If you have Xvfb running in the background, you can add ``--headless`` to your run command in order to utilize it. For more info about the Xvfb plugin, [read this](http://qxf2.com/blog/xvfb-plugin-for-jenkins-selenium/). For a real-world Jenkins example of headless browser automation in action, check out [the SeleniumBase Google Cloud ReadMe](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md).
* You can use [the Selenium Grid](https://github.com/SeleniumHQ/selenium/wiki/Grid2) to scale your testing by distributing tests on several machines with parallel execution. To do this, check out the SeleniumBase [selenium_grid folder](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/selenium_grid), which should have everything you need. The [Selenium Grid ReadMe](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/selenium_grid/ReadMe.md) will help you get started.
* You can use [the Selenium Grid](https://github.com/SeleniumHQ/selenium/wiki/Grid2) to scale your testing by distributing tests on several machines with parallel execution. To do this, check out the SeleniumBase [selenium_grid folder](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_grid), which should have everything you need. The [Selenium Grid ReadMe](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md) will help you get started.
* If you're using the [SeleniumBase MySQL feature](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mysql_installation.md) to save results from tests running on a server machine, you can install [MySQL Workbench](http://dev.mysql.com/downloads/tools/workbench/) to help you read & write from your DB more easily. You'll also need to install the MySQL Python client. Depending on your system, you may need to install additional requirements for this (such as on Windows). See [Stackoverflow](https://stackoverflow.com/questions/43102442/whats-the-difference-between-mysqldb-mysqlclient-and-mysql-connector-python) for more info.
@ -696,4 +696,4 @@ Congratulations on getting started with SeleniumBase!
[https://github.com/mdmintz](https://github.com/mdmintz)<br />
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Button3.png" title="SeleniumBase" height="60">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) <br /> <img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="150">
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo3g.png" title="SeleniumBase" height="60">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) <br /> <img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="150">

View File

@ -11,7 +11,7 @@
* Backwards-compatible with [WebDriver](http://www.seleniumhq.org/projects/webdriver/). (Use ``self.driver`` anywhere.)
* Can run tests through a proxy server. (Use ``--proxy=IP_ADDRESS:PORT``)
* Includes a hybrid-automation solution called **[MasterQA](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/masterqa/ReadMe.md)** to speed up manual testing.
* Includes integrations with [MySQL](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/testcase_manager.py), [Selenium Grid](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/selenium_grid), [Google Cloud](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/google_cloud/ReadMe.md), [Amazon S3](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/s3_logging_plugin.py), and [NodeJS](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js).
* Includes a [tool to convert Selenium IDE recordings](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/selenium_ide) into clean & robust SeleniumBase scripts.
* Includes integrations with [MySQL](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/testcase_manager.py), [Selenium Grid](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_grid), [Google Cloud](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/google_cloud/ReadMe.md), [Amazon S3](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/s3_logging_plugin.py), and [NodeJS](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js).
* Includes a [tool to convert Selenium IDE recordings](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_ide) into clean & robust SeleniumBase scripts.
* Written in Python, but can also make JavaScript calls using ``self.execute_script()``.
* Includes useful Python decorators and password obfuscation methods. ([Learn more here](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/common/ReadMe.md))

View File

@ -11,7 +11,7 @@ seleniumbase install iedriver
seleniumbase install operadriver
```
If you plan on using the [Selenium Grid integration](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/selenium_grid/ReadMe.md) (which allows for remote webdriver), you'll need to put the drivers on your System PATH. On a Mac and Linux, ``/usr/local/bin`` is a good PATH spot. On Windows, you may need to set the System PATH under Environment Variables to include the location where you placed the driver files. As a shortcut, you could place the driver files into your Python ``Scripts/`` folder in the location where you have Python installed, which should already be on your System PATH.
If you plan on using the [Selenium Grid integration](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md) (which allows for remote webdriver), you'll need to put the drivers on your System PATH. On a Mac and Linux, ``/usr/local/bin`` is a good PATH spot. On Windows, you may need to set the System PATH under Environment Variables to include the location where you placed the driver files. As a shortcut, you could place the driver files into your Python ``Scripts/`` folder in the location where you have Python installed, which should already be on your System PATH.
Here's where you can go to manually install web drivers from the source:

View File

@ -1 +1 @@
## This page has been moved to: [../selenium_ide/ReadMe.md](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/selenium_ide/ReadMe.md)
### The ReadMe for the Katalon / Selenium IDE conversion tool has been moved to: [seleniumbase/utilities/selenium_ide/ReadMe.md](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_ide/ReadMe.md) and all related code has been moved to [seleniumbase/utilities/selenium_ide](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_ide)

View File

@ -1,29 +1 @@
## The Selenium Grid Hub
The Selenium Grid Hub lets you distribute tests to run in parallel across multiple node machines. Each node machine can then run its own allocation of tests. This allows you to run a large suite of tests very quickly.
### Running the Selenium Grid Hub
The following commands will work once you've installed seleniumbase, which comes with the seleniumbase console scripts interface.
Grid Hub server controls:
```bash
seleniumbase grid-hub {start|stop|restart} [OPTIONS]
```
Options:
* ``-v``, ``--verbose`` (Increases verbosity of logging output.)
Grid node server controlls:
```bash
seleniumbase grid-node {start|stop|restart} --hub=[HUB_IP] [OPTIONS]
```
Options:
* ``-v``, ``--verbose`` (Increases verbosity of logging output.)
* ``--hub=[HUB_IP]`` (Specifies the Grid Hub to connect to. Default: "127.0.0.1".)
When the Grid Hub Console is up and running, you'll be able to find it here: [http://127.0.0.1:4444/grid/console](http://127.0.0.1:4444/grid/console)
#### More info about the Selenium Grid Hub can be found here:
* [https://github.com/SeleniumHQ/selenium/wiki/Grid2](https://github.com/SeleniumHQ/selenium/wiki/Grid2)
* [https://github.com/SeleniumHQ/selenium/wiki](https://github.com/SeleniumHQ/selenium/wiki/Grid2)
### The ReadMe for the Selenium Grid Hub Launcher has been moved to: [seleniumbase/utilities/selenium_grid/ReadMe.md](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md) and all related code has been moved to [seleniumbase/utilities/selenium_grid](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid)

View File

@ -1,29 +1 @@
## Converting Katalon/Selenium IDE recordings into SeleniumBase test scripts
[Katelon Recorder / Selenium IDE](https://www.katalon.com/resources-center/blog/katalon-automation-recorder/) (<i>the successor to the [old Selenium IDE](http://docs.seleniumhq.org/projects/ide/)</i>) is a tool that allows you to record and playback actions performed inside a web browser. It's available as a [downloadable Chrome extension](https://chrome.google.com/webstore/detail/katalon-recorder-selenium/ljdobmomdgdljniojadhoplhkpialdid) and a [downloadable Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/katalon-automation-record/). Katelon Recorder comes with an option to export recordings as various WebDriver test scripts, one of which is ``Python 2 (WebDriver + unittest)``. Unfortunately, these natively-exported scripts can be very messy and don't always run reliably. The purpose of this converter is to clean up and improve the scripts so that they can be used in production-level environments.
#### Step 1: Make a recording with Katelon Recorder
![](https://cdn2.hubspot.net/hubfs/100006/images/katalon_recorder_2.png "Katelon Recorder example")
#### Step 2: Export your recording as a Python 2 Webdriver script
* ``{} Export`` => ``Python 2 (WebDriver + unittest)`` => ``Save As File``
#### Step 3: Drop your exported file into the ``selenium_ide`` folder
* Just copy & paste!
(The full path of the folder is ``SeleniumBase/integrations/selenium_ide``)
#### Step 4: Run ``convert_ide.py`` on the exported Python script
```bash
python convert_ide.py [MY_TEST.py]
```
You should see a [MY_TEST_SB.py] file appear in the folder. (``_SB`` is added to the file name so that the original file stays intact in case you still need it.)
#### Step 5: Enjoy your new clean & reliable SeleniumBase test script
* You can now copy your new SeleniumBase test script into your test suite. It's ready to be run!
### The ReadMe for the Katalon / Selenium IDE conversion tool has been moved to: [seleniumbase/utilities/selenium_ide/ReadMe.md](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_ide/ReadMe.md) and all related code has been moved to [seleniumbase/utilities/selenium_ide](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_ide)

View File

@ -13,11 +13,11 @@ seleniumbase grid-node start --hub=127.0.0.1
"""
import sys
from console_scripts import sb_mkdir
from console_scripts import sb_install
from integrations.selenium_grid import grid_hub
from integrations.selenium_grid import grid_node
from integrations.selenium_ide import convert_ide
from seleniumbase.console_scripts import sb_mkdir
from seleniumbase.console_scripts import sb_install
from seleniumbase.utilities.selenium_grid import grid_hub
from seleniumbase.utilities.selenium_grid import grid_node
from seleniumbase.utilities.selenium_ide import convert_ide
def show_usage():

View File

@ -20,7 +20,7 @@ import shutil
import sys
import tarfile
import zipfile
import drivers # webdriver storage folder for SeleniumBase
from seleniumbase import drivers # webdriver storage folder for SeleniumBase
if sys.version_info[0] == 2:
from urllib import urlopen
else:

View File

@ -260,6 +260,8 @@ def main():
file = codecs.open(file_path, "w+", "utf-8")
file.writelines("\r\n".join(data))
file.close()
print('''\n* Directory "%s" was created with config files '''
'''and sample tests! *\n''' % dir_name)
if __name__ == "__main__":

View File

@ -10,7 +10,7 @@ from seleniumbase.config import proxy_list
from seleniumbase.core import download_helper
from seleniumbase.fixtures import constants
from seleniumbase.fixtures import page_utils
import drivers # webdriver storage folder for SeleniumBase
from seleniumbase import drivers # webdriver storage folder for SeleniumBase
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
PLATFORM = sys.platform
LOCAL_CHROMEDRIVER = None

View File

@ -1,13 +1,22 @@
### SeleniumBase web driver storage
* Usage:
#### Usage:
```bash
```
seleniumbase install chromedriver
seleniumbase install geckodriver
seleniumbase install edgedriver
seleniumbase install iedriver
seleniumbase install operadriver
```
After running the commands above, web drivers will get downloaded into this folder. SeleniumBase will then use those drivers during test runs if present. (The drivers don't come with SeleniumBase by default.)
If the necessary driver is not found in this location while running tests, SeleniumBase will instead look for the driver on the System PATH. If the necessary driver is not on the System PATH either, you'll get errors.
#### Notes:
* chromedriver allows you to run browser tests on Chrome
* geckodriver allows you to run browser tests on Firefox
* edgedriver allows you to run browser tests on MS Edge
* iedriver allows you to run browser tests on MS IE
* operadriver allows you to run browser tests on Opera

View File

@ -0,0 +1,29 @@
## The Selenium Grid Hub
The Selenium Grid Hub lets you distribute tests to run in parallel across multiple node machines. Each node machine can then run its own allocation of tests. This allows you to run a large suite of tests very quickly.
### Running the Selenium Grid Hub
The following commands will work once you've installed seleniumbase, which comes with the seleniumbase console scripts interface.
Grid Hub server controls:
```
seleniumbase grid-hub {start|stop|restart} [OPTIONS]
```
Options:
* ``-v``, ``--verbose`` (Increases verbosity of logging output.)
Grid node server controlls:
```
seleniumbase grid-node {start|stop|restart} --hub=[HUB_IP] [OPTIONS]
```
Options:
* ``-v``, ``--verbose`` (Increases verbosity of logging output.)
* ``--hub=[HUB_IP]`` (Specifies the Grid Hub to connect to. Default: "127.0.0.1".)
When the Grid Hub Console is up and running, you'll be able to find it here: [http://127.0.0.1:4444/grid/console](http://127.0.0.1:4444/grid/console)
#### More info about the Selenium Grid Hub can be found here:
* [https://github.com/SeleniumHQ/selenium/wiki/Grid2](https://github.com/SeleniumHQ/selenium/wiki/Grid2)
* [https://github.com/SeleniumHQ/selenium/wiki](https://github.com/SeleniumHQ/selenium/wiki/Grid2)

View File

@ -49,7 +49,7 @@ def main():
file.writelines("\r\n".join(data))
file.close()
from integrations.selenium_grid import download_selenium_server
from seleniumbase.utilities.selenium_grid import download_selenium_server
download_selenium_server.main() # Nothing happens if already exists
if "linux" in sys.platform or "darwin" in sys.platform:

View File

@ -60,7 +60,7 @@ def main():
file.writelines("\r\n".join(data))
file.close()
from integrations.selenium_grid import download_selenium_server
from seleniumbase.utilities.selenium_grid import download_selenium_server
download_selenium_server.main() # Nothing happens if already exists
if "linux" in sys.platform or "darwin" in sys.platform:

View File

@ -0,0 +1,19 @@
## Converting Katalon/Selenium IDE recordings into SeleniumBase test scripts
[Katelon Recorder / Selenium IDE](https://www.katalon.com/resources-center/blog/katalon-automation-recorder/) (<i>the successor to the [old Selenium IDE](http://docs.seleniumhq.org/projects/ide/)</i>) is a tool that allows you to record and playback actions performed inside a web browser. It's available as a [downloadable Chrome extension](https://chrome.google.com/webstore/detail/katalon-recorder-selenium/ljdobmomdgdljniojadhoplhkpialdid) and a [downloadable Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/katalon-automation-record/). Katelon Recorder comes with an option to export recordings as various WebDriver test scripts, one of which is ``Python 2 (WebDriver + unittest)``. Unfortunately, these natively-exported scripts can be very messy and don't always run reliably. The purpose of this converter is to clean up and improve the scripts so that they can be used in production-level environments.
#### Step 1: Make a recording with Katelon Recorder
![](https://cdn2.hubspot.net/hubfs/100006/images/katalon_recorder_2.png "Katelon Recorder example")
#### Step 2: Export your recording as a Python 2 Webdriver script
* ``{} Export`` => ``Python 2 (WebDriver + unittest)`` => ``Save As File``
#### Step 3: Run ``seleniumbase convert`` on your exported Python file
```
seleniumbase convert [MY_TEST.py]
```
* You should see a [MY_TEST_SB.py] file appear in the folder. (``_SB`` is added to the file name so that the original file stays intact in case you still need it.) This new clean & reliable SeleniumBase test script is ready to be added into your test suite for running.

View File

@ -7,7 +7,7 @@ from setuptools import setup, find_packages # noqa
setup(
name='seleniumbase',
version='1.13.7',
version='1.14.0',
description='Web Automation & Testing Framework - http://seleniumbase.com',
long_description='Web Automation and Testing Framework - seleniumbase.com',
platforms='Mac * Windows * Linux * Docker',
@ -38,19 +38,19 @@ setup(
packages=['seleniumbase',
'seleniumbase.common',
'seleniumbase.config',
'seleniumbase.console_scripts',
'seleniumbase.core',
'seleniumbase.drivers',
'seleniumbase.fixtures',
'seleniumbase.masterqa',
'seleniumbase.plugins',
'console_scripts',
'drivers',
'integrations',
'integrations.selenium_grid',
'integrations.selenium_ide',
'seleniumbase.utilities',
'seleniumbase.utilities.selenium_grid',
'seleniumbase.utilities.selenium_ide',
],
entry_points={
'console_scripts': [
'seleniumbase = console_scripts.run:main',
'seleniumbase = seleniumbase.console_scripts.run:main',
],
'nose.plugins': [
'base_plugin = seleniumbase.plugins.base_plugin:Base',