Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Not able to run the the selenium Test cases on chrome driver version121
  • Loading branch information
nakka-sandeep authored Feb 20, 2024
1 parent d2dab62 commit 1757613
Showing 1 changed file with 13 additions and 47 deletions.
60 changes: 13 additions & 47 deletions chromedriver.groovy
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]));

0 comments on commit 1757613

Please sign in to comment.