Back to the problems...
So, im inserting the explorer in GUI, easier to visualize the tests...
Code: Select all
/*
SCMT V2
*/
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
#SingleInstance Force
DetectHiddenWindows, On
#include, includes\gui.ahk
Logfile = %A_ScriptDir%\logs\error_log.txt
; ****************************************************************************************
; * FUNCTIONS
; ****************************************************************************************
countdown(){
GuiControl,,WorkingStatus, Restarting tests in 5 seconds.
Sleep 1000
GuiControl,,WorkingStatus, Restarting tests in 4 seconds.
Sleep 1000
GuiControl,,WorkingStatus, Restarting tests in 3 seconds.
Sleep 1000
GuiControl,,WorkingStatus, Restarting tests in 2 seconds.
Sleep 1000
GuiControl,,WorkingStatus, Restarting tests in 1 seconds.
Sleep 1000
GuiControl,,WorkingStatus, Restarting tests Now.
Sleep 1000
}
clearFields(){
GuiControl,,WorkingStatus, Reseting fields..
GuiControl,,HeaderStatus, ....
GuiControl,,MenuStatus, ....
GuiControl,,ContentStatus, ....
GuiControl,,FooterStatus, ....
GuiControl,,UsernameStatus, ....
GuiControl,,PasswordStatus, ....
GuiControl,,LoginValidator, ....
GuiControl,,FirstHeaderStatus, ....
GuiControl,,SecondHeaderStatus, ....
GuiControl,,LoggedInProfileMenu, ....
GuiControl,,LoggedInHeaderMenuIcon, ....
}
getElementById(obj,ele,ByRef tracker){
if obj.document.getElementById(ele){
GuiControl,,tracker, OK
}
else
{
GuiControl,,tracker, FAIL
}
}
loginForm(){
WB.Document.getElementbyId("username").Click() ;~NOT WORKING
SendRaw, testuser ;~NOT WORKING
WB.Document.getElementbyId("password").Click() ;~NOT WORKING
SendRaw, testpass ;~NOT WORKING
WB.Document.getElementbyId("signIn").Click() ;~NOT WORKING
}
FilePrepend(fileIN, string){
IfNotExist, %fileIN%
return false
input := FileOpen(fileIN, 0)
,text := input.Read()
,input.Close()
,output := FileOpen(fileIN, 5)
,output.WriteLine(string)
,output.Write(text)
,output.Close()
return true
}
; ****************************************************************************************
; * PROG SETUP
; ****************************************************************************************
main:
{
Gosub,init
url:="insertwebsitehere"
WB.Navigate(url)
loop
If !WB.busy
break
return
}
init:
{
OnExit,terminate
Gui, +LastFound +OwnDialogs
Gui, Add, ActiveX, w600 h500 x530 y10 vWB hwndATLWinHWND, Shell.Explorer
WB.silent := true
gui,show, w1140 h515 , SCMT v2
return
}
runtests:
runit:
{
getElementById(WB,"header",HeaderStatus)
getElementById(WB,"content",ContentStatus)
getElementById(WB,"footer",FooterStatus)
getElementById(WB,"horizontalNavigation",MenuStatus)
sleep 2000
getElementById(WB,"username",UsernameStatus)
getElementById(WB,"password",PasswordStatus)
getElementById(WB,"errorMessage",LoginValidator)
sleep 2000
loginForm()
sleep 8000
getElementById(WB,"searchHeader",FirstHeaderStatus)
getElementById(WB,"kadHeaing",SecondHeaderStatus)
getElementById(WB,"profileMenu",LoggedInProfileMenu)
getElementById(WB,"headerMenuIcon",LoggedInHeaderMenuIcon)
Sleep 2000
return
}
GuiClose:
terminate:
{
Gui, Destroy
ExitApp
}
Restart:
reload
return
GTFO:
ViewLogs:
ClearLogs:
Paused:
RestartByUser:
return
The function is not working, as the form does not receive data....