Skip to content

Commit c48a7ad

Browse files
authored
Merge pull request #141 from seleniumbase/small-updates
Small updates
2 parents 8156534 + fae953a commit c48a7ad

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,16 @@ The ``--with-testing_base`` plugin gives you full logging on test failures, whic
148148
```bash
149149
cd examples/
150150

151-
pytest my_first_test.py --with-testing_base --browser=firefox
152-
153151
pytest my_first_test.py --with-testing_base --browser=chrome
152+
153+
pytest my_first_test.py --with-testing_base --browser=firefox
154154
```
155155

156-
(NOTE: If you're using **pytest** instead of nosetests for running tests outside of the SeleniumBase repo, **you'll need a copy of [pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini) at the base of the new folder structure, already provided here.**
156+
If you want to run tests headlessly, use ``--headless``, which you'll need to do if your system lacks a GUI interface. Even if your system does have a GUI interface, it may still support headless browser automation.
157+
158+
For running tests outside of the SeleniumBase repo with **Pytest**, you'll want a copy of **[pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.)
159+
160+
For running tests outside of the SeleniumBase repo with **Nosetests**, you'll want a copy of **[setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.)
157161

158162
If you want to pass additional data from the command line to your tests, you can use ``--data=STRING``. Now inside your tests, you can use ``self.data`` to access that.
159163

@@ -190,11 +194,9 @@ nosetests my_test_suite.py --with-testing_base --report
190194

191195
Here are some things you can do to setup a production environment for your testing:
192196

193-
* You can setup a [Jenkins](https://jenkins.io/) build server for running tests at regular intervals. (Or you can use any build server you want.)
194-
195-
* You can use [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, just spin up some remote machines with WebDriver installed, then update the *.cfg file that lives with your tests on your build server to point there. When doing so, add the command line option to use that file like this: ``--config=[MY_CONFIG_FILE].cfg``). An example config file called selenium_server_config_example.cfg has been provided for you in the integrations/selenium_grid folder. The start-selenium-node.bat and start-selenium-server.sh files are for running your grid. In an example situation, your Selenium Grid server might live on a unix box and your Selenium Grid nodes might live on EC2 Windows virtual machines. When your build server runs a Selenium test, it would connect to your Selenium Grid to find out which Grid browser nodes are available to run that test. To simplify things, you can use [Browser Stack](https://www.browserstack.com/automate) as your entire Selenium Grid (and let them do all the fun work of maintaining the grid for you).
197+
* 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).
196198

197-
* There are ways of running your tests from Jenkins without having to utilize a remote machine. One way is by using PhantomJS as your browser (it runs headlessly). Another way is by using Xvfb (another headless system). [There's a plugin for Xvfb in Jenkins](https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin). If you have Xvfb running in the background, you can add ``--headless`` to your run command in order to utilize it. For information about the Xvfb plugin for Jenkins, [click here](http://qxf2.com/blog/xvfb-plugin-for-jenkins-selenium/). To see 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), which covers this topic with screenshots.
199+
* 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.
198200

199201
* 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 connector. Depending on your system, you may have to install this a bit differently from the command below:
200202

integrations/selenium_grid/ReadMe.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ When running with nosetests, configure a "``setup.cfg``" file with your grid hub
3333
When running with pytest, add the server and port info to a "``pytest.ini``" file. (Or add that data directly on the command line when you run your tests.)
3434

3535
#### More detailed info about connecting to the Selenium Grid Hub can be found here:
36-
* [https://theintern.github.io/intern/#selenium-grid](https://theintern.github.io/intern/#selenium-grid)
3736
* [https://github.com/SeleniumHQ/selenium/wiki/Grid2](https://github.com/SeleniumHQ/selenium/wiki/Grid2)
3837
* [https://github.com/SeleniumHQ/selenium/wiki](https://github.com/SeleniumHQ/selenium/wiki/Grid2)

seleniumbase/core/browser_launcher.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ def get_local_driver(browser_name, headless):
147147
firefox_driver = webdriver.Firefox(
148148
firefox_profile=profile, capabilities=firefox_capabilities)
149149
return firefox_driver
150-
except Exception:
150+
except Exception as e:
151+
if headless:
152+
raise Exception(e)
151153
return webdriver.Firefox()
152154
if browser_name == constants.Browser.INTERNET_EXPLORER:
153155
return webdriver.Ie()
@@ -179,5 +181,7 @@ def get_local_driver(browser_name, headless):
179181
# Run Chrome in full screen mode on MAC/Linux
180182
chrome_options.add_argument("--kiosk")
181183
return webdriver.Chrome(chrome_options=chrome_options)
182-
except Exception:
184+
except Exception as e:
185+
if headless:
186+
raise Exception(e)
183187
return webdriver.Chrome()

seleniumbase/fixtures/base_case.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,14 +887,14 @@ def generate_referral(self, start_page, destination_page):
887887
"(Use an empty string or None to start from current page.)"
888888
% start_page)
889889
self.open(start_page)
890-
time.sleep(0.03)
890+
time.sleep(0.08)
891891
referral_link = ('''<a class='analytics referral test' href='%s'>'''
892892
'''Generate Free Referral!</a>''' % destination_page)
893893
self.execute_script(
894894
'''document.body.innerHTML = \"%s\"''' % referral_link)
895-
time.sleep(0.05)
895+
time.sleep(0.1)
896896
self.click("a.analytics") # Clicks the generated button
897-
time.sleep(0.03)
897+
time.sleep(0.12)
898898

899899
def generate_traffic(self, start_page, destination_page, loops=1):
900900
""" Similar to generate_referral(), but can do multiple loops. """

server_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='seleniumbase',
11-
version='1.5.4',
11+
version='1.5.5',
1212
description='Web Automation & Testing Framework - http://seleniumbase.com',
1313
long_description='Web Automation and Testing Framework - seleniumbase.com',
1414
platforms='Mac * Windows * Linux * Docker',

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='seleniumbase',
11-
version='1.5.4',
11+
version='1.5.5',
1212
description='Web Automation & Testing Framework - http://seleniumbase.com',
1313
long_description='Web Automation and Testing Framework - seleniumbase.com',
1414
platforms='Mac * Windows * Linux * Docker',

0 commit comments

Comments
 (0)