added function to get latest stable chrome version, function to get URLs for chrome and chromedriver for that given version
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user