From: Jetha Chan Date: Mon, 22 Feb 2016 07:36:11 +0000 (+0900) Subject: Extract Selenium JAR url from Google APIs XML. X-Git-Tag: v1.5.5~6 X-Git-Url: https://git.cameron1729.xyz/?a=commitdiff_plain;h=be7a5e1feb3983ccdda0a9f01fb96f57af251dc5;p=mdk.git Extract Selenium JAR url from Google APIs XML. --- diff --git a/mdk/commands/behat.py b/mdk/commands/behat.py index 2f3b3e6..2845d0f 100644 --- a/mdk/commands/behat.py +++ b/mdk/commands/behat.py @@ -189,17 +189,19 @@ class BehatCommand(Command): seleniumPath = args.selenium elif args.seleniumforcedl or (not nojavascript and not os.path.isfile(seleniumPath)): logging.info('Attempting to find a download for Selenium') - url = urllib.urlopen('http://docs.seleniumhq.org/download/') + seleniumStorageUrl = 'https://selenium-release.storage.googleapis.com/' + url = urllib.urlopen(seleniumStorageUrl) content = url.read() - selenium = re.search(r'http:[a-z0-9/._-]+selenium-server-standalone-[0-9.]+\.jar', content, re.I) - if selenium: - logging.info('Downloading Selenium from %s' % (selenium.group(0))) + matches = sorted(re.findall(r'[a-z0-9/._-]+selenium-server-standalone-[0-9.]+\.jar', content, re.I)) + if len(matches) > 0: + seleniumUrl = seleniumStorageUrl + matches[-1] + logging.info('Downloading Selenium from %s' % seleniumUrl) if (logging.getLogger().level <= logging.INFO): - urllib.urlretrieve(selenium.group(0), seleniumPath, downloadProcessHook) + urllib.urlretrieve(seleniumUrl, seleniumPath, downloadProcessHook) # Force a new line after the hook display logging.info('') else: - urllib.urlretrieve(selenium.group(0), seleniumPath) + urllib.urlretrieve(seleniumUrl, seleniumPath) else: logging.warning('Could not locate Selenium server to download')