added function to get latest stable chrome version, function to get URLs for chrome and chromedriver for that given version

main
Yuriy 1 year ago
parent 324d5a177a
commit 7afb2274a2

@ -59,7 +59,28 @@ GetChromeVersion(){
}
GetURLofLatestChromedriver(ChromeVersion){
GetLatestChromeStableVersion(){
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
json_str := urldownloadtovar("https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json")
; converts json data variable into object
parsed := JSON.Load(json_str)
try CurrentChromeStableVersion := parsed.channels.stable.version
if(CurrentChromeStableVersion = ""){
return "Failed to parse json. "
}
return CurrentChromeStableVersion
}
GetDownloadURLOfChromeAndDriver(ChromeVersion){
; Will return the download URL of Chrome for Testing and Chrome Driver, seperated by a ||
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
json_str := urldownloadtovar("https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json")
@ -84,22 +105,25 @@ GetURLofLatestChromedriver(ChromeVersion){
VersionIndex := A_Index
; loop through the platforms to get download URL
; loop through the platforms to get download URL for Chrome
loop % parsed.versions[VersionIndex].downloads.chrome.count() {
if(parsed.versions[VersionIndex].downloads.chrome[A_Index].platform = "win64")
chromeDLURL64 := parsed.versions[VersionIndex].downloads.chromedriver[A_Index].url
}
; loop through the platforms to get download URL for Chromedriver
loop % parsed.versions[VersionIndex].downloads.chromedriver.count() {
; 64 bit version
if(parsed.versions[VersionIndex].downloads.chromedriver[A_Index].platform = "win64")
chromedriverDLURL64 := parsed.versions[VersionIndex].downloads.chromedriver[A_Index].url
; 32 bit version
if(parsed.versions[VersionIndex].downloads.chromedriver[A_Index].platform = "win32")
chromedriverDLURL32 := parsed.versions[VersionIndex].downloads.chromedriver[A_Index].url
}
break
}
}
; Msgbox % "chromedriverDLURL32: " chromedriverDLURL32
; Msgbox % "chromedriverDLURL64: " chromedriverDLURL64
return chromedriverDLURL32
URLS = %chromeDLURL64%||%chromedriverDLURL64%
return URLS
}
Loading…
Cancel
Save