diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-11-12 23:34:39 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-11-12 23:34:39 +0100 |
commit | 0def1cd3cf12ebd2eacf807cbb3d1c3597bcd162 (patch) | |
tree | a47dca39c584515b5afadd5dcbe6436bfa64feb8 /selenium/chrome_responsive.py | |
parent | 3264067ce3b563c846e1247d71a87c7faaaa93b1 (diff) | |
download | wallet-core-0def1cd3cf12ebd2eacf807cbb3d1c3597bcd162.tar.xz |
selenium: test if chrome is responsive
Diffstat (limited to 'selenium/chrome_responsive.py')
-rw-r--r-- | selenium/chrome_responsive.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/selenium/chrome_responsive.py b/selenium/chrome_responsive.py new file mode 100644 index 000000000..57dd7dc43 --- /dev/null +++ b/selenium/chrome_responsive.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 + +""" +Tests for the wallet. It looks for an env variable called TALER_BASEURL +where it appends "/banks" etc. in order to find bank and shops. If not +found, it defaults to https://test.taler.net/ +""" + +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.support.ui import WebDriverWait, Select +from selenium.common.exceptions import NoSuchElementException, TimeoutException +from selenium.webdriver.common.action_chains import ActionChains +from urllib import parse +import argparse +import time +import logging +import sys +import os +import re +import json + +logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) +logger = logging.getLogger(__name__) + +def client_setup(args): + """Return a dict containing the driver and the extension's id""" + co = webdriver.ChromeOptions() + cap = co.to_capabilities() + cap['loggingPrefs'] = {'driver': 'INFO', 'browser': 'INFO'} + + if args.remote: + client = webdriver.Remote(desired_capabilities=cap, command_executor=args.remote) + else: + client = webdriver.Chrome(desired_capabilities=cap) + client.get('http://lemonde.fr') + html = client.find_element(By.TAG_NAME, "html") + +parser = argparse.ArgumentParser() +parser.add_argument('--remote', help="Points webdriver.Remote at URI", metavar="URI", type=str, dest="remote") +args = parser.parse_args() +ret = client_setup(args) +client = ret['client'] +logger.info("Chromium is responsive") +client.close() +sys.exit(0) |