I'm writing a script that interacts with a webpage.
The contents of the webpage depend on the size of the browser window.
To get the (for me) correct contents from the page, the browser window must be maximized.
However, I also don't need or want to see the browser window when the script creates it, so it should be invisible.
At first I created the browser window with simply this:
$oIE = _IECreate ($url ,0 ,0 ,1 ,0) However, from the results I can see that the invisible browser window isn't maximized.
So I changed the code to maximize the window, but then it becomes visible.
Now I have this:
$oIE = _IECreate ($url ,0 ,0 ,1 ,0) $hIE = _IEPropertyGet($oIE, "hwnd") WinSetState($hIE, "", @SW_MAXIMIZE) WinSetState($hIE, "", @SW_HIDE) ...but then I do see the browser window shortly when it is maximized.
I could live with that if it were just a single browser window. But the script is opening (and closing) quite a few browser windows, and I don't wait to see them flicker, nor do I want to (be able to accidentally) interact with these windows.
Any ideas on how to create and invisible yet maximized IE windows?
I am looking for a way to automate login to a Internet Banking website (https://bank.tymedigital.co.za/) and all of the examples that I could found still do not solve my issue with this website.
In order to Login, the user need to enter their Identity Number and Password the click the Login button.
Inspecting the Elements in Chrome are as follow;
<input autocomplete="username" placeholder="Please enter your South African ID number" maxlength="13" type="tel" class="form-control" value=""> Password
<input autocomplete="current-password" placeholder="Enter password" type="password" class="form-control" value=""> Button
<button type="button" class="btn btn-yellow btn-block">Login</button> Any assistance or directing me to a solution will be appreciated.
ConsoleWrite("Hello Dolly on Line 1" & @CRLF) #include <IE.au3> ConsoleWrite("Hello Dolly on Line 5" & @CRLF) Local $oIE = _IECreate("www.autoitscript.com") ConsoleWrite("Hello Dolly on Line 10" & @CRLF) Can anyone put me on the right track to troubleshoot this one.. the IE browser is not opening.. it is not my primary browser since FF is but that has not been a problem in the past.. it all seems to work including compile but the generation of the IE browser.. Never had any problem before.. below is the results of the run.. any ideas on where I might look.. that is the only error i get and its only after a 30 second delay.. I suppose a time out..
; >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "G:\show_pos.au3\test.au3"
; Hello Dolly on Line 1
; Hello Dolly on Line 5
; --> IE.au3 T3.0-2 Error from function _IECreate, (Browser Object Creation Failed)
; Hello Dolly on Line 10
; >Exit code: 0 Time: 30.46
I am still really new with AutoIT. We are using it to automate logging into web sites and I have encountered problems with focus. The target web page is configured to put the cursor into the first text field (username) when the page is loaded, and when I run the AutoIT script, which does the log in seems like it is just not starting where I expect it to be.
I have been kind of using ToolTip() to kind of help with debugging, but now I am wondering if the calls to ToolTip() are causing the focus to be messed up.
For example, at least visually, when the ToolTip() is called, I can see the cursor disappear from the web page text field and they when I do anything that is supposed to send keystrokes, they are going off somwhere else ("never-neverland").
But when I remove some of the ToolTip() calls, it works correctly.
So the questions I have are:
1) Do the ToolTip() calls interfere with/change where the focus on the target page are?
2) In general, what are the "rules" for where ToolTip can be used "safely" (== doesn't interfere with focus)?
for some script I need to investigate the states checked/unchecked, hidden/shown, enabled/disabled to several checkbox controls.
Any suggestions to this script to retrieve the information in a better way?
; Autoit Version 188.8.131.52 ; GuiCtrlCheckState.au3 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $CtrlW = 100 $CtrlH = 30 $GuiW = 250 $GuiH = 300 GUICreate("Test Checkbox Status", $GuiW, $GuiH) $Ctrl = GUICtrlCreateCheckbox("Checkbox", 10, 10, $CtrlW, $CtrlH) Opt("Guicoordmode", 2) $BtnDisable = GUICtrlCreateButton("Disable", -1, 10) $BtnEnable = GUICtrlCreateButton("Enable", -1, 1) $BtnHide = GUICtrlCreateButton("Hide", 10, -$CtrlH * 2 - 1) $BtnUnHide = GUICtrlCreateButton("Show (Unhide)", -1, 1) $BtnCheckChecked = GUICtrlCreateButton("IsChecked", -$CtrlW * 2 - 10, 40) $BtnCheckEnabled = GUICtrlCreateButton("IsEnabled", -1, 1) $BtnCheckHidden = GUICtrlCreateButton("IsHidden", -1, 1) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $BtnDisable GUICtrlSetState($Ctrl, $gui_disable) Case $BtnEnable GUICtrlSetState($Ctrl, $GUI_Enable) Case $BtnHide GUICtrlSetState($Ctrl, $GUI_Hide) Case $BtnUnHide GUICtrlSetState($Ctrl, $GUI_show) Case $BtnCheckChecked If CheckState($Ctrl, $GUI_CHECKED) Then ConsoleWrite("Checked" & @CRLF) Else ConsoleWrite("not checked" & @CRLF) EndIf Case $BtnCheckEnabled If CheckState($Ctrl, $GUI_Enable) Then ConsoleWrite("enabled" & @CRLF) Else ConsoleWrite("disabled" & @CRLF) EndIf Case $BtnCheckHidden If CheckState($Ctrl, $GUI_Hide) Then ConsoleWrite("Hidden" & @CRLF) Else ConsoleWrite("not hidden" & @CRLF) EndIf EndSwitch WEnd Func CheckState($_CtrlID, $_State = $GUI_CHECKED) ConsoleWrite("---------------------" & @CRLF) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $_State to check = ' & $_State & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $_Read = GUICtrlRead($_CtrlID) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $_Read (GuiCtrlRead) = ' & $_Read & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $_StateFound = GUICtrlGetState($_CtrlID) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $_StateFound (GuiCtrlGetState) = ' & $_StateFound & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console If $_StateFound = -1 Then MsgBox(48, "Control-ID not defined", "Control-ID invalid") Return False ElseIf BitAND($_StateFound, $_State) = $_State Then Return True ElseIf BitAND($_Read, $_State) = $_State Then Return True Else Return False EndIf EndFunc ;==>CheckState Regards, Rudi.