Skip to content

Commit 82c8f5b

Browse files
committed
Merge branch 'master' into new-test-structure
2 parents dd06779 + 82ec47f commit 82c8f5b

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

install-dev-dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if type apt-get >/dev/null ; then
1515
chromium-chromedriver
1616
elif type brew >/dev/null ; then
1717
brew list python &>/dev/null || brew install python
18-
brew install libxml2 gnu-sed
18+
brew install libxml2 gnu-sed chromedriver
1919
if ! echo $PATH | grep -ql /usr/local/bin ; then
2020
echo '/usr/local/bin not found in $PATH, please add it.'
2121
fi

test/chromium/script.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
# of linux is required for the script to run correctly as well.
1111
# Otherwise, use pyvirtualdisplay.
1212

13-
import time, sys, glob, os, traceback
13+
import sys
1414
from selenium import webdriver
15-
from selenium.webdriver.chrome.options import Options
16-
from selenium.webdriver.support.wait import WebDriverWait
17-
from selenium.webdriver.support import expected_conditions
18-
from selenium.webdriver.common.by import By
1915
from selenium.common.exceptions import WebDriverException
2016

17+
if sys.platform.startswith("linux"):
18+
chromedriver_path = "/usr/lib/chromium-browser/chromedriver"
19+
elif sys.platform.startswith("darwin"):
20+
chromedriver_path = "chromedriver"
21+
else:
22+
print "Unsupported Operating System"
23+
sys.exit(3)
24+
2125
class bcolors:
2226
HEADER = '\033[95m'
2327
OKBLUE = '\033[94m'
@@ -34,25 +38,27 @@ class bcolors:
3438
# First argument is optional, if not specified will search path.
3539

3640
try:
37-
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', chrome_options = chromeOps)
41+
driver = webdriver.Chrome(chromedriver_path, chrome_options=chromeOps)
3842
except WebDriverException as e:
3943
error = e.__str__()
4044

4145
if "executable needs to be in PATH" in e.__str__():
42-
print "ChromeDriver isn't installed. Check test/chrome/README.md for instructions on how to install ChromeDriver"
46+
print "ChromeDriver isn't installed. Check test/chrome/README.md\
47+
for instructions on how to install ChromeDriver"
4348
sys.exit(0)
4449
else:
4550
driver.quit()
4651
raise e
47-
sys.exit(2)
52+
53+
print '' #New line
4854

4955
driver.get('http://libssh.org/robots.txt')
5056

5157
#Page Loaded
5258

5359
if driver.current_url.startswith('https'):
5460
print bcolors.OKGREEN + "HTTP to HTTPS redirection successful" + bcolors.ENDC
55-
elif(driver.current_url.startswith('http')):
61+
elif driver.current_url.startswith('http'):
5662
print bcolors.FAIL + "HTTP to HTTPS redirection failed" + bcolors.ENDC
5763
sys.exit(1)
5864

0 commit comments

Comments
 (0)