Added function for checking javascript element values

pull/2/head
Yuriy 2 years ago
parent 1048b80de4
commit 409e93e7d1

@ -214,3 +214,131 @@ Selenium_LoopToClearXpath(Xpath,NumOfLoops:=1,SleepLength:=1000){
;---\Selenium--- ;---\Selenium---
;------------------------------------------------ ;------------------------------------------------
; -------------------------------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)
OnMessage(0x44, "OnMsgBoxJSReturnData")
MsgBox 0x3,.TextContent:,%status%
OnMessage(0x44, "")
IfMsgBox Yes,{
} 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)
OnMessage(0x44, "OnMsgBoxJSReturnData")
MsgBox 0x3,.value:,%status%
OnMessage(0x44, "")
IfMsgBox Yes,{
} 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)
OnMessage(0x44, "OnMsgBoxJSReturnData")
MsgBox 0x3, .innerText,%status%
OnMessage(0x44, "")
IfMsgBox Yes,{
} 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)
OnMessage(0x44, "OnMsgBoxJSReturnData")
MsgBox 0x3, .outerText,%status%
OnMessage(0x44, "")
IfMsgBox Yes,{
} 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)
OnMessage(0x44, "OnMsgBoxJSReturnData")
MsgBox 0x3, .innerHTML,%status%
OnMessage(0x44, "")
IfMsgBox Yes,{
} 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)
OnMessage(0x44, "OnMsgBoxJSReturnData")
MsgBox 0x3, .outerHTML,%status%
OnMessage(0x44, "")
IfMsgBox Yes,{
} Else IfMsgBox No, {
TextForClip =js = %js% `n try,status := driver.executeScript(js)
Clipboard := TextForClip
} Else IfMsgBox Cancel, {
return
}
} ; end of fuctions
OnMsgBoxJSReturnData() {
DetectHiddenWindows, On
Process, Exist
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
ControlSetText Button1, OK
ControlSetText Button2, Copy
ControlSetText Button3, Return
}
}

Loading…
Cancel
Save