From c6cf2a408a2b7d08c400ac71ebbcdb395959c4f0 Mon Sep 17 00:00:00 2001 From: yuriy Date: Sun, 30 Jul 2023 22:14:41 -0400 Subject: [PATCH] added function to send text to xpath element letter-by-letter --- Selenium-Functions.ahk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Selenium-Functions.ahk b/Selenium-Functions.ahk index faa681d..dbf3e5d 100644 --- a/Selenium-Functions.ahk +++ b/Selenium-Functions.ahk @@ -773,6 +773,29 @@ Selenium_LoopToClearXpath(Xpath,NumOfLoops:=1,SleepLength:=1000){ } } + + +Selenium_TypeTextIntoElement(Text, Xpath){ + + StrLengthOfPost := StrLen(Text) + Loop % StrLengthOfPost{ + + Current_Char := SubStr(Text, A_index, 1) + ; Msgbox % "Current_Char: " Current_Char + + ; driver.FindElementByXPath(Xpath).SendKeys(VAR) + + Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100,StringTextContent:=Current_Char) + if(Status){ + Message = Failed to Input Text + Return Message + } + } +} + + + + SaveDriverURLOFErrorPage(){ ; save the url of the result page. That way if a tab is not found for a site, we can open up a tab from this tab instead of middle of nowhere. That way we can keep the tabs together try URLOfLastErrorPage := driver.URL }