selenium: .crx passed in options

This commit is contained in:
Marcello Stanisci 2016-05-12 15:06:53 +02:00
parent d9c77abed0
commit db79e76b62

View File

@ -27,14 +27,13 @@ taler_baseurl = os.environ.get('TALER_BASEURL', 'https://test.taler.net/')
def client_setup(args): def client_setup(args):
"""Return a dict containing the driver and the extension's id""" """Return a dict containing the driver and the extension's id"""
co = webdriver.ChromeOptions() co = webdriver.ChromeOptions()
co.add_argument("load-extension=" + args.extdir) co.add_extension(args.ext)
cap = co.to_capabilities() cap = co.to_capabilities()
cap['loggingPrefs'] = {'driver': 'INFO', 'browser': 'INFO'} cap['loggingPrefs'] = {'driver': 'INFO', 'browser': 'INFO'}
if args.remote: if args.remote:
client = webdriver.Remote(desired_capabilities=cap, command_executor=args.remote) client = webdriver.Remote(desired_capabilities=cap, command_executor=args.remote)
else: else:
client = webdriver.Chrome(desired_capabilities=cap) client = webdriver.Chrome(desired_capabilities=cap)
# client = webdriver.Chrome(chrome_options=co, desired_capabilities=cap)
client.get('https://taler.net') client.get('https://taler.net')
listener = """\ listener = """\
document.addEventListener('taler-id', function(evt){ document.addEventListener('taler-id', function(evt){
@ -220,7 +219,7 @@ def withdraw(client, amount_value=None):
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--extdir', help="Folder containing the unpacked extension", metavar="EXTDIR", type=str, dest="extdir", required=True) parser.add_argument('--ext', help="packed extension (.crx file)", metavar="CRX", type=str, dest="ext", required=True)
parser.add_argument('--remote', help="Whether the test is to be run against URI, or locally", metavar="URI", type=str, dest="remote") parser.add_argument('--remote', help="Whether the test is to be run against URI, or locally", metavar="URI", type=str, dest="remote")
args = parser.parse_args() args = parser.parse_args()
logger.info("Getting extension's ID..") logger.info("Getting extension's ID..")