Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SeleniumBase Docker Image
FROM ubuntu:14.04
FROM ubuntu:17.10

#=======================================
# Install Python and Basic Python Tools
Expand All @@ -14,24 +14,18 @@ RUN apt-get -qy --no-install-recommends install \
unzip \
wget \
curl \
libxi6 \
libgconf-2-4 \
vim \
xvfb \
&& rm -rf /var/lib/apt/lists/*

#========================================
# Add normal user with passwordless sudo
#========================================
RUN sudo useradd seluser --shell /bin/bash --create-home \
&& sudo usermod -a -G sudo seluser \
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers

#==============================
# Locale and encoding settings
#==============================
ENV LANGUAGE en_US.UTF-8
ENV LANG ${LANGUAGE}
RUN locale-gen ${LANGUAGE} \
&& dpkg-reconfigure --frontend noninteractive locales
#RUN sudo useradd seluser --shell /bin/bash --create-home \
# && sudo usermod -a -G sudo seluser \
# && echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers

#======================
# Install Chromedriver
Expand Down Expand Up @@ -96,6 +90,8 @@ RUN exec "$@"
#=====================
COPY seleniumbase /SeleniumBase/seleniumbase/
COPY examples /SeleniumBase/examples/
COPY console_scripts /SeleniumBase/console_scripts/
COPY integrations /SeleniumBase/integrations/
COPY requirements.txt /SeleniumBase/requirements.txt
COPY setup.py /SeleniumBase/setup.py
RUN pip install --upgrade pip
Expand Down
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
## Automated testing made fast, easy, and reliable.
## SeleniumBase Automation Framework

<img src="https://cdn2.hubspot.net/hubfs/100006/images/laptop_logo.png" title="SeleniumBase" height="160">

<img src="https://cdn2.hubspot.net/hubfs/100006/images/new_logo_pre6c.png" title="SeleniumBase" height="40"><br />
[![](https://img.shields.io/pypi/v/seleniumbase.svg)](https://pypi.python.org/pypi/seleniumbase) [![Build Status](https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master)](https://travis-ci.org/seleniumbase/SeleniumBase) [![Join the chat at https://gitter.im/seleniumbase/SeleniumBase](https://badges.gitter.im/seleniumbase/SeleniumBase.svg)](https://gitter.im/seleniumbase/SeleniumBase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br />

[![](https://img.shields.io/pypi/v/seleniumbase.svg)](https://pypi.python.org/pypi/seleniumbase) [![Build Status](https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master)](https://travis-ci.org/seleniumbase/SeleniumBase)<br />
SeleniumBase makes it easy to build & run [Selenium-WebDriver](https://github.com/SeleniumHQ/selenium) automation with [Pytest](https://docs.pytest.org/en/latest/).

SeleniumBase simplifies Web-UI automation by extending Python's unittest framework with WebDriver APIs and intelligent code.

<img src="https://cdn2.hubspot.net/hubfs/100006/images/expanded_icons2f.png" title="SeleniumBase" height="102">
**Watch [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) run in [Demo Mode](#seleniumbase_demo_mode):**<br>
![](https://cdn2.hubspot.net/hubfs/100006/images/sb_demo.gif "SeleniumBase")<br>

### [**Get Started**](#seleniumbase_installation), or Learn More:

Expand All @@ -30,10 +29,6 @@ pytest my_first_test.py --browser=chrome
nosetests my_test_suite.py --browser=firefox
```

**Watch [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) run in [Demo Mode](#seleniumbase_demo_mode):**<br>
![](https://cdn2.hubspot.net/hubfs/100006/images/sb_demo.gif "SeleniumBase")<br>
(<i>If you remove all the asserts from that test, you're left with [basic_script.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/basic_script.py), which performs all the actions you can see when running the test.</i>)

**No more messy code:**<br />
This long line of standard WebDriver code,
```python
Expand Down Expand Up @@ -150,16 +145,16 @@ nosetests my_first_test.py --browser=firefox
(<i>If no browser is specified, Chrome is used by default.</i>)

<a id="seleniumbase_demo_mode"></a>
If the example test is moving too fast for your eyes to see what's going on, you can run it in **Demo Mode** by adding ``--demo_mode`` on the command line, which pauses the browser briefly between actions, and highlights page elements being acted on:
If the example test is moving too fast for your eyes to see what's going on, you can run it in **Demo Mode** by adding ``--demo_mode`` on the command line, which pauses the browser briefly between actions, highlights page elements being acted on, and lets you know what test assertions are happening in real time:

```bash
pytest my_first_test.py --browser=chrome --demo_mode
pytest my_first_test.py --demo_mode
```

You can override the default wait time by either updating [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) or by using ``--demo_sleep={NUM}`` when using Demo Mode. (NOTE: If you use ``--demo_sleep={NUM}`` without using ``--demo_mode``, nothing will happen.)

```bash
pytest my_first_test.py --browser=chrome --demo_mode --demo_sleep=1.2
pytest my_first_test.py --demo_mode --demo_sleep=1.2
```

You can also use the following in your scripts to slow down the tests:
Expand Down
6 changes: 4 additions & 2 deletions integrations/docker/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers

Here are a few of those cleanup commands:

docker container prune
docker system prune
docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi
docker rm 'docker ps --no-trunc -aq'

Expand All @@ -71,5 +73,5 @@ https://codefresh.io/blog/everyday-hacks-docker/

#### 13. (Optional) More reading on Docker can be found here:
* https://docs.docker.com
* https://docs.docker.com/mac/started/
* https://docs.docker.com/installation/mac/
* https://docs.docker.com/get-started/
* https://docs.docker.com/docker-for-mac/
4 changes: 3 additions & 1 deletion integrations/linux/Linuxfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ sudo apt-get -f install -y --force-yes firefox

# Install more dependencies
sudo apt-get update
sudo apt-get install -y --force-yes curl
sudo apt-get install -y --force-yes xvfb
sudo apt-get install -y --force-yes build-essential chrpath libssl-dev libxft-dev
sudo apt-get install -y --force-yes libfreetype6 libfreetype6-dev
Expand All @@ -75,7 +76,8 @@ sudo apt-get -f install -y --force-yes
sudo dpkg -i google-chrome-stable_current_amd64.deb

# Install Chromedriver
sudo wget -N http://chromedriver.storage.googleapis.com/2.36/chromedriver_linux64.zip -P ~/Downloads
CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
sudo wget -N http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip -P ~/Downloads
sudo unzip -o ~/Downloads/chromedriver_linux64.zip -d ~/Downloads
sudo chmod +x ~/Downloads/chromedriver
sudo rm -f /usr/local/share/chromedriver
Expand Down
3 changes: 3 additions & 0 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ def add_css_link(self, css_link):
'''link.rel = "stylesheet"; '''
'''link.type = "text/css"; '''
'''link.href = "%s"; '''
'''link.crossorigin = "anonymous"; '''
'''document.getElementsByTagName("head")[0]'''
'''.appendChild(link);''')
self.execute_script(add_css_link_script % css_link)
Expand All @@ -722,6 +723,8 @@ def add_js_link(self, js_link):
script_to_add_js = (
'''var script = document.createElement("script"); '''
'''script.src = "%s"; '''
'''script.defer; '''
'''script.crossorigin = "anonymous"; '''
'''document.getElementsByTagName("head")[0]'''
'''.appendChild(script);''')
self.execute_script(script_to_add_js % js_link)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='seleniumbase',
version='1.12.2',
version='1.12.3',
description='Web Automation & Testing Framework - http://seleniumbase.com',
long_description='Web Automation and Testing Framework - seleniumbase.com',
platforms='Mac * Windows * Linux * Docker',
Expand Down