From 4eada9ea7603439cf42a3b9d523b79b2a40b3697 Mon Sep 17 00:00:00 2001 From: yuriy Date: Tue, 28 Feb 2023 20:42:12 -0500 Subject: [PATCH] added function to get the baseurl of current tab, small bug fix within chrome tab activation function --- Selenium-Shared-Functions.ahk | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Selenium-Shared-Functions.ahk b/Selenium-Shared-Functions.ahk index 073e1db..71fe577 100644 --- a/Selenium-Shared-Functions.ahk +++ b/Selenium-Shared-Functions.ahk @@ -15,6 +15,12 @@ CheckCurrentTabForCurrentSite(){ */ +GetCurrentTabURlBase(){ + try, TabURL := driver.url + TabURL := ExtractBaseURL(TabURL) + return TabURL +} + ExtractBaseURL(URL){ URLBase := StrReplace(URL,"https://","") ; remove beginning of URL @@ -76,7 +82,7 @@ NavigateFromBaseURLTo(URL,PageTitle := "TodoDeleteme"){ ChromeTabsURLArray.Push(URL) ; Append the new url to the array NewTabCreated := 1 sleep, 1000 - status := ActivateChromeTab(URLBase) + status := ActivateChromeTab(URL) if(Status = "Failed"){ Message = Failed to activate tab for %urlBase% after 2 atteppts. Chrome stuck on a dialog box of some sort? SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") @@ -122,9 +128,10 @@ NavigateFromBaseURLTo(URL,PageTitle := "TodoDeleteme"){ } - +; -------------------------------ActivateChromeTab------------------------------- ActivateChromeTab(URL){ - ; convert to baseUR + + ; Extract Base URL if necessary if(InStr(URL, "/")){ URLBase := ExtractBaseURL(URL) } @@ -300,7 +307,7 @@ SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){ ; Save current chrome version to ini file return Driver } - + ; -------------------------------/SChrome_Get------------------------------- /* */