forked from jenkins-infra/crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Not able to run the the selenium Test cases on chrome driver version121
- Loading branch information
1 parent
d2dab62
commit 1757613
Showing
1 changed file
with
13 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,21 @@ | ||
#!./lib/runner.groovy | ||
// Generates server-side metadata for chromedriver auto-installation | ||
import net.sf.json.* | ||
import groovy.util.XmlSlurper | ||
import groovy.json.JsonSlurper | ||
import groovy.json.JsonOutput | ||
|
||
def baseUrl = 'https://chromedriver.storage.googleapis.com/' | ||
def json = [] | ||
def map = [:].withDefault {[:].withDefault {[:]}} | ||
def url = 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json' | ||
def jsonString = new URL(url).text | ||
def jsonData = new JsonSlurper().parseText(jsonString) | ||
|
||
def xml = new XmlSlurper().parseText(new URL(baseUrl).text) | ||
xml.Contents.each { | ||
def key = it.Key.text() | ||
def m = key =~ /(.*)\/chromedriver_(.*?)(\d+)\.zip/ | ||
if (m) { | ||
def (_, version, os, arch) = m[0] | ||
map[os][arch][version] = key | ||
json << ["id":"${os}${arch}_${version}".toString(), "url":baseUrl + key]; | ||
} | ||
} | ||
def jsonList = [] | ||
|
||
map.each { os, arch -> | ||
if (arch.size() == 1) { | ||
def latest = arch.find().value.max { a, b -> | ||
List verA = a.key.tokenize('.') | ||
List verB = b.key.tokenize('.') | ||
def commonIndices = Math.min(verA.size(), verB.size()) | ||
for (int i = 0; i < commonIndices; ++i) { | ||
def numA = verA[i].toInteger() | ||
def numB = verB[i].toInteger() | ||
if (numA != numB) { | ||
return numA <=> numB | ||
} | ||
} | ||
verA.size() <=> verB.size() } | ||
json << ["id":os, "url":baseUrl + latest.value]; | ||
} else { | ||
arch.each { k, v -> | ||
def latest = v.max { a, b -> | ||
List verA = a.key.tokenize('.') | ||
List verB = b.key.tokenize('.') | ||
def commonIndices = Math.min(verA.size(), verB.size()) | ||
for (int i = 0; i < commonIndices; ++i) { | ||
def numA = verA[i].toInteger() | ||
def numB = verB[i].toInteger() | ||
if (numA != numB) { | ||
return numA <=> numB | ||
} | ||
} | ||
verA.size() <=> verB.size() } | ||
json << ["id":os + k, "url":baseUrl + latest.value]; | ||
} | ||
} | ||
// Extract information only for the "Stable" channel | ||
def stableData = jsonData.channels.Stable | ||
def chromeDriverData = stableData.downloads.chromedriver | ||
chromeDriverData.each { entry -> | ||
def id = "${entry.platform}_${stableData.version}" | ||
def url = entry.url | ||
jsonList << ["id": id, "url": url] | ||
} | ||
|
||
lib.DataWriter.write("org.jenkins-ci.plugins.chromedriver.ChromeDriver",JSONObject.fromObject([list:json])); |