added function for sending data with js and double checking that it got input
This commit is contained in:
@@ -16,6 +16,25 @@ JS_TryToExecute(JsToExecute,NumberofAttempts := 1,SleepLength:=1000){
|
||||
|
||||
|
||||
|
||||
js_SendAndCheckWithQuerySelector(Selector,ValueToCheck:="value",SleepLength:=1000,JSStringText:="TEXT"){
|
||||
js = document.querySelector("%Selector%").value = "%JSStringText%";
|
||||
try driver.executeScript(js)
|
||||
|
||||
sleep, %SleepLength%
|
||||
|
||||
js = return document.querySelector("#title").value;
|
||||
try, status := driver.executeScript(js)
|
||||
|
||||
; DevModeMsgBox(status)
|
||||
|
||||
if(Status = "")
|
||||
return "Failed"
|
||||
else,
|
||||
return ""
|
||||
|
||||
}
|
||||
|
||||
|
||||
; ValueToCheckOptions = innertext,textContent,InnerHTML,outerHTML,value,href,option value
|
||||
js_SendAndCheckWithClassName(ClassName:="",ClassIndexNum:=0,ValueToCheck:="textContent",SleepLength:=1000,JSStringText:="TEXT"){
|
||||
jsSend = document.getElementsByClassName('%ClassName%')[%ClassIndexNum%].value = "%JSStringText%";
|
||||
@@ -217,123 +236,123 @@ Selenium_LoopToClearXpath(Xpath,NumOfLoops:=1,SleepLength:=1000){
|
||||
|
||||
; -------------------------------Javascript-------------------------------
|
||||
ReturnAndDisplayJSData(jsref){
|
||||
; msgbox, here goes
|
||||
; https://www.w3schools.com/jsref/dom_obj_all.asp
|
||||
; -----TEXT CONTENT-----
|
||||
js = return %jsref%.textContent;
|
||||
try status := driver.executeScript(js)
|
||||
; msgbox, here goes
|
||||
; https://www.w3schools.com/jsref/dom_obj_all.asp
|
||||
; -----TEXT CONTENT-----
|
||||
js = return %jsref%.textContent;
|
||||
try status := driver.executeScript(js)
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3,.TextContent:,%status%
|
||||
OnMessage(0x44, "")
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3,.TextContent:,%status%
|
||||
OnMessage(0x44, "")
|
||||
|
||||
IfMsgBox Yes,{
|
||||
IfMsgBox Yes,{
|
||||
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
|
||||
; -----VALUE-----
|
||||
js = return %jsref%.value;
|
||||
try status := driver.executeScript(js)
|
||||
; -----VALUE-----
|
||||
js = return %jsref%.value;
|
||||
try status := driver.executeScript(js)
|
||||
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3,.value:,%status%
|
||||
OnMessage(0x44, "")
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3,.value:,%status%
|
||||
OnMessage(0x44, "")
|
||||
|
||||
IfMsgBox Yes,{
|
||||
IfMsgBox Yes,{
|
||||
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
|
||||
; -----INNERTEXT-----
|
||||
js = return %jsref%.innerText;
|
||||
try status := driver.executeScript(js)
|
||||
; -----INNERTEXT-----
|
||||
js = return %jsref%.innerText;
|
||||
try status := driver.executeScript(js)
|
||||
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3, .innerText,%status%
|
||||
OnMessage(0x44, "")
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3, .innerText,%status%
|
||||
OnMessage(0x44, "")
|
||||
|
||||
IfMsgBox Yes,{
|
||||
IfMsgBox Yes,{
|
||||
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
; -----OuterText-----
|
||||
js = return %jsref%.outerText;
|
||||
try status := driver.executeScript(js)
|
||||
; -----OuterText-----
|
||||
js = return %jsref%.outerText;
|
||||
try status := driver.executeScript(js)
|
||||
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3, .outerText,%status%
|
||||
OnMessage(0x44, "")
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3, .outerText,%status%
|
||||
OnMessage(0x44, "")
|
||||
|
||||
IfMsgBox Yes,{
|
||||
IfMsgBox Yes,{
|
||||
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
;-----innerHTML-----
|
||||
js = return %jsref%.innerHTML;
|
||||
try status := driver.executeScript(js)
|
||||
;-----innerHTML-----
|
||||
js = return %jsref%.innerHTML;
|
||||
try status := driver.executeScript(js)
|
||||
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3, .innerHTML,%status%
|
||||
OnMessage(0x44, "")
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3, .innerHTML,%status%
|
||||
OnMessage(0x44, "")
|
||||
|
||||
IfMsgBox Yes,{
|
||||
IfMsgBox Yes,{
|
||||
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip = js = %js% `n try, status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
; -----outerHTML-----
|
||||
js = return %jsref%.outerHTML;
|
||||
try status := driver.executeScript(js)
|
||||
; -----outerHTML-----
|
||||
js = return %jsref%.outerHTML;
|
||||
try status := driver.executeScript(js)
|
||||
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3, .outerHTML,%status%
|
||||
OnMessage(0x44, "")
|
||||
OnMessage(0x44, "OnMsgBoxJSReturnData")
|
||||
MsgBox 0x3, .outerHTML,%status%
|
||||
OnMessage(0x44, "")
|
||||
|
||||
IfMsgBox Yes,{
|
||||
IfMsgBox Yes,{
|
||||
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip =js = %js% `n try,status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
} Else IfMsgBox No, {
|
||||
TextForClip =js = %js% `n try,status := driver.executeScript(js)
|
||||
Clipboard := TextForClip
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
} ; end of fuctions
|
||||
} ; end of fuctions
|
||||
|
||||
|
||||
OnMsgBoxJSReturnData() {
|
||||
OnMsgBoxJSReturnData() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
@@ -341,4 +360,4 @@ OnMsgBoxJSReturnData() {
|
||||
ControlSetText Button2, Copy
|
||||
ControlSetText Button3, Return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user