Skip to content

Commit fb24e86

Browse files
committed
Use focal (20.04), latest geckodriver in the CI tests, drop sudo.
Ignore test failures due to incompatibility with the current alpha.
2 parents 69cfaa5 + bf7451e commit fb24e86

6 files changed

Lines changed: 37 additions & 22 deletions

File tree

.travis.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
sudo: false
22
language: python
33
os: linux
4-
dist: trusty
5-
group: deprecated-2017Q4
4+
dist: focal
5+
services:
6+
- xvfb
7+
addons:
8+
apt:
9+
sources:
10+
- sourceline: 'deb https://deb.torproject.org/torproject.org focal main'
11+
packages:
12+
- tor
13+
- tor-geoipdb
614
env:
715
global:
816
- DOWNLOAD_DIR=${HOME}/download
9-
- STABLE=10.0
17+
- STABLE=10.0.1
1018
- EXPERIMENTAL=10.5a1
1119
- TBB_DIST_URL=https://www.torproject.org/dist/torbrowser/
1220
matrix:
@@ -16,27 +24,22 @@ cache:
1624
- ${DOWNLOAD_DIR}
1725
matrix:
1826
include:
19-
- python: "2.7"
27+
- python: "3.6"
2028
env: VERSION_ARCH="${EXPERIMENTAL}/tor-browser-linux64-${EXPERIMENTAL}_en-US.tar.xz"
21-
- python: "2.7"
29+
- python: "3.6"
2230
env: VERSION_ARCH="${EXPERIMENTAL}/tor-browser-linux64-${EXPERIMENTAL}_zh-CN.tar.xz"
23-
- python: "2.7"
31+
- python: "3.6"
2432
env: VERSION_ARCH="${EXPERIMENTAL}/tor-browser-linux64-${EXPERIMENTAL}_ar.tar.xz"
25-
- python: "2.7"
33+
- python: "3.6"
2634
env: VERSION_ARCH="${STABLE}/tor-browser-linux64-${STABLE}_en-US.tar.xz"
27-
- python: "2.7"
35+
- python: "3.6"
2836
env: VERSION_ARCH="${STABLE}/tor-browser-linux64-${STABLE}_zh-CN.tar.xz"
29-
- python: "2.7"
30-
env: VERSION_ARCH="${STABLE}/tor-browser-linux64-${STABLE}_ar.tar.xz"
3137
- python: "3.6"
38+
env: VERSION_ARCH="${STABLE}/tor-browser-linux64-${STABLE}_ar.tar.xz"
39+
- python: "2.7"
3240
env: VERSION_ARCH="${STABLE}/tor-browser-linux64-${STABLE}_en-US.tar.xz"
3341
exclude:
3442
- env: TRAVIS_EXTRA_JOB_WORKAROUND=true
35-
before_install:
36-
- "export DISPLAY=:99.0"
37-
- "sh -e /etc/init.d/xvfb start"
38-
- sudo apt-get -qq update
39-
- sudo apt-get install -y tor
4043
install:
4144
- pip install -r requirements-travis.txt
4245
- pip install .

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Check the [examples](https://github.com/webfp/tor-browser-selenium/tree/master/e
8484
## Compatibility
8585
[Tested](https://travis-ci.org/webfp/tor-browser-selenium) with the following Tor Browser Bundle versions on Debian and Ubuntu:
8686

87-
* 10.0
87+
* 10.0.1
8888
* 10.5a1
8989

9090
Windows and macOS are not supported.
@@ -97,15 +97,17 @@ Solutions to potential issues:
9797
* Outdated (or incompatible) Python `selenium` package: This is the source of various obscure errors. Make sure you have `selenium` version **3.3** or above.
9898
* No display: When running on a cloud machine, follow the [headless.py example](https://github.com/webfp/tor-browser-selenium/blob/master/examples/headless.py#L10) to start a virtual display.
9999
* Outdated Tor Browser Bundle: Download and use a more recent TBB version.
100-
* Make sure you install geckodriver version v0.23.0 or newer.
100+
* Make sure you install the latest geckodriver version.
101101
* Port conflict with other (`Tor`) process: Pick a different SOCKS and controller port using `socks_port` argument.
102-
* Use `tbb_logfile_path` argument of TorBrowserDriver to debug obscure errors. This can help with problems due to missing display, missing libraries (e.g. when the LD_LIBRARY_PATH is not set correctly) or other errors that Tor Browser logs to standard output.
102+
* Use `tbb_logfile_path` argument of TorBrowserDriver to debug obscure errors. This can help with problems due to missing display, missing libraries (e.g. when the LD_LIBRARY_PATH is not set correctly) or other errors that Tor Browser logs to standard output/error.
103103
* When you use `LAUNCH_NEW_TBB_TOR` option and get the following [error message](https://github.com/webfp/tor-browser-selenium/issues/62) during the initialization, it's likely that Tor failed to bootstrap (due to network etc.):
104104

105105
```
106106
Can't load the profile. Profile Dir: /tmp/tmpO7i1lL/webdriver-py-profilecopy If you specified a log_file in the FirefoxBinary constructor, check it for details
107107
```
108108
* `driver.get_cookies()` returns an empty list. This is due to Private Browsing Mode (PBM), which Selenium uses under the hood. See [#79](https://github.com/webfp/tor-browser-selenium/issues/79) for a possible solution.
109+
* WebGL is not supported in the headless mode started with `headless=True` due to Firefox bug [#1375585](https://bugzilla.mozilla.org/show_bug.cgi?id=1375585). To enable WebGL in a headless setting, use `pyvirtualdisplay` following the [headless.py](https://github.com/webfp/tor-browser-selenium/tree/master/examples/headless.py) example.
110+
* `set_security_level` doesn't work with the current alpha (10.5a1).
109111

110112
## Credits
111113
We greatly benefited from the following two projects:

tbselenium/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@
5151
USE_STEM = 2 # use tor started with Stem
5252

5353
TRAVIS = "CI" in environ and "TRAVIS" in environ
54+
# TODO: remove once the issue is resolved
55+
CI_ALPHA_TEST = "a" in environ.get('VERSION_ARCH', '').split("/")[0]

tbselenium/test/test_env.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
from distutils.version import LooseVersion
44

55

6+
# https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
7+
MINIMUM_SELENIUM_VERSION = "3.14"
8+
9+
610
class EnvironmentTest(unittest.TestCase):
711

812
def test_selenium_version(self):
913
import selenium
1014
pkg_ver = selenium.__version__
11-
self.assertGreaterEqual(LooseVersion(pkg_ver), LooseVersion("2.45"))
15+
self.assertGreaterEqual(LooseVersion(pkg_ver), LooseVersion(MINIMUM_SELENIUM_VERSION))
1216

1317
def test_geckodriver_version(self):
1418
"""Make sure that the right geckodriver version is installed."""
15-
GECKODRIVER_VERSION_STR = "geckodriver 0.24.0"
19+
GECKODRIVER_VERSION_STR = "geckodriver 0.27.0"
1620
gd_v_out = check_output(["geckodriver", "-V"]).decode("utf-8")
1721
self.assertIn(GECKODRIVER_VERSION_STR, gd_v_out.split("\n")[0])
1822

tbselenium/test/test_set_security_level.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import unittest
2+
import pytest
23
from selenium.common.exceptions import NoSuchElementException, TimeoutException
34
from selenium.webdriver.common.by import By
45
from tbselenium.test.fixtures import TBDriverFixture
56
from tbselenium.test import TBB_PATH
6-
from tbselenium.common import CHECK_TPO_URL
7+
from tbselenium.common import CHECK_TPO_URL, CI_ALPHA_TEST
78
from tbselenium.utils import set_security_level
89
from tbselenium.utils import SECURITY_HIGH, SECURITY_MEDIUM, SECURITY_LOW
910

@@ -33,6 +34,9 @@ def test_set_security_medium(self):
3334
except (NoSuchElementException, TimeoutException):
3435
pass
3536

37+
@pytest.mark.skipif(
38+
CI_ALPHA_TEST,
39+
reason="Not compatible with the current alpha (10.5a1)")
3640
def test_set_security_high(self):
3741
with TBDriverFixture(TBB_PATH) as driver:
3842
set_security_level(driver, SECURITY_HIGH)

travis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ echo ${TBB_DIST_URL}/${VERSION_ARCH}
77
tar -xf ${DOWNLOAD_DIR}/$TARBALL -C $HOME
88
echo `which curl`
99

10-
geckodriver_url="https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz"
10+
geckodriver_url="https://github.com/mozilla/geckodriver/releases/download/v0.27.0/geckodriver-v0.27.0-linux64.tar.gz"
1111
geckodriver_tarball=`basename ${geckodriver_url}`
1212
echo $geckodriver_tarball
1313
wget -P ${DOWNLOAD_DIR} $geckodriver_url

0 commit comments

Comments
 (0)