Robotframework RIDE AutoIt control to press Stop - automation

I am trying to use AutoIt to activate a running RobotFramework RIDE window and press the stop button. When using the AutoIt info tool I find that the Stop button is located within a toolbar. I have pasted the output from that tool here:
>>>> Window <<<<
Title: RIDE - Security
Class: wxWindowClassNR
Position: 665, 0
Size: 935, 860
Style: 0x16CF0000
ExStyle: 0x00000100
Handle: 0x0002052E
>>>> Control <<<<
Class: ToolbarWindow32
Instance: 1
ClassnameNN: ToolbarWindow321
Name:
Advanced (Class): [CLASS:ToolbarWindow32; INSTANCE:1]
ID:
Text:
Position: 304, 79
Size: 615, 28
ControlClick Coords: 45, 14
Style: 0x52001101
ExStyle: 0x00000000
Handle: 0x0003047A
>>>> Mouse <<<<
Position: 1022, 143
Cursor ID: 0
Color: 0xB6DBEE
>>>> StatusBar <<<<
1:
>>>> ToolsBar <<<<
1: 145 Start
2: 146 Stop
3: 147 Pause
4: 148 Continue
5: 149 Next
6: 150 Step over
From this output it can be seen that the Stop button has a Command ID 146.
In terms of an AutoIt script I am trying the following:
WinActivate("RIDE - Security")
ControlClick("[CLASS:wxWindowClassNR]", "", "[CLASS:ToolbarWindow32; INSTANCE:1]", "Start")
What am I missing or doing incorrectly?
Thanks!

On ToolbarWindow32 controls you usually have to use ControlCommand with the SendCommandID option. This should work for you.
$hWinHandle = WinGetHandle("RIDE - Security")
;make sure we have focus
ControlFocus($hWinHandle, "", "[CLASS:ToolbarWindow32; INSTANCE:1]")
;uses the ControlCommand to access the stop
ControlCommand($hWinHandle, "", "[CLASS:ToolbarWindow32; INSTANCE:1]", "SendCommandID", "146")

Related

Use Control Send and Control Click In AutoIT to Automate Background Processes

I'm having Issue getting AutoITv3 to send a Control Down key stroke to a background program using the ControlSend function. I've been successful in getting the ControlClick function to work as shown below.
I've tried using both the ClassnameNN and the Class as the Control ID, both Failed. I've also attempted to add the "0 flag" as the last argument just in case the default was somehow changed.
Current Script
$wPos = WinGetPos("[Conquer] Raiding Clans")
WinActivate("[Conquer] Raiding Clans")
Sleep(2000)
ControlSend("[Conquer] Raiding Clans","","[CLASS:#32770]","{CTRLDOWN}")
ControlClick("[Conquer] Raiding Clans","","[CLASS:#32770]","left",1,$wPos[0] + 60 , $wPos[1] + 150)
AutoItv3 Window Info Tool Summary
>>>> Window <<<<
Title: [Conquer] Raiding Clans
Class: Afx:400000:0:10007:0:0
Position: 160, 136
Size: 1600, 768
Style: 0x94000000
ExStyle: 0x00000000
Handle: 0x019B16EE
>>>> Control <<<<
Class: #32770
Instance: 1
ClassnameNN: #327701
Name:
Advanced (Class): [CLASS:#32770; INSTANCE:1]
ID:
Text:
Position: 0, 0
Size: 1600, 768
ControlClick Coords: 105, 295
Style: 0x50000044
ExStyle: 0x00040000
Handle: 0x00381172
>>>> Mouse <<<<
Position: 265, 431
Cursor ID: 0
Color: 0x9FA8AA
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<
??
CSConceal
Prefix1
Prefix2
Prefix3
Prefix4
Prefix5
Prefix6
Prefix7
Prefix8
Prefix9
Prefix10
Prefix11
Prefix12
Prefix13
Prefix14
Prefix15
Prefix16
Prefix17
Prefix18
Prefix19
Prefix20
Prefix21
OpenVip
????
Close
OUTCHAT
OK
S
C
C
A
L
LOG
A
??
??
??
??
??
?
??
??
??
??
??
PK
???
?
??
?
btn
Equipment
Draw
CSMore
>>>> Hidden Text <<<<
XP1
XP2
XP3
XP4
XP5
XP6
XP7
XP8
XP9
XP10
U
D
Progress1
?
Progress3
Progress1
Progress2
Progress1
The expected function of this script would be for the script to hold down control and then click at a given set of coordinates.

Selenium entered value in input text box is not visible during run time and hence test failed

Selenium entered a value in input text box is not visible during run time and hence test failed
When the test runs as per the test steps the value is entered in the Input text box but when it moves to last text box, the previous text box values are not visible and textbox looks empty. Hence test failed as unable to proceed.
Selenium: 2.53.0
Firefox: 45
Code:
getDriver().switchTo().frame(
getDriver().findElement(
By.xpath("//iframe[#src='/bi-sac-config-mgr/SMTP']")));
if (!waitForObject("psm_nhp_mailsave", m_largeTime * 2)) {
getLogger().error("Save mail settings unavailable");
} else {
waitForObject("psmsacmailserverxpath", m_largeTime * 2);
setObject("psmsacmailserverxpath",
"internal-mail-router.gmail.com");
waitForObject("psmsacmailportxpath", m_largeTime * 2);
setObject("psmsacmailportxpath", "25");
waitForObject("psmsacmaildisplaynamexpath", m_largeTime * 2);
setObject("psmsacmaildisplaynamexpath", "matstest");
waitForObject("psmsacmailemailxpath", m_largeTime * 2);
setObject("psmsacmailemailxpath", "matstest#gmail.com");
In the above code, after entering psmsacmailserverxpath which is a mandatory text field, the value gets disappeared runtime. Manually it works fine. In automation using Selenium, this issue is seen.
html element:
<input id="mail-server-input" class="oj-form-control oj-inputtext oj-inputtext-input oj-component-initnode" data-bind="ojComponent: {component: 'ojInputText',
invalidComponentTracker: tracker,
value:smtpConfig.host,
required: true,
validators: [{type: 'length',
options: {min: 0,
max: 250,
hint:null}}],
displayOptions:{validatorHint: 'none'}}" type="text" placeholder="" aria-invalid="false" aria-required="true">

VB .net queue strange behaviour with threads

I'm writing an vb .net form application for receiving data from commport, parsing on commport_thread and send messages to UI thread through queue.
App structure looks like this:
Private _SerialCommunicationThread As Thread
Public _DataQueue As Queue = Queue.Synchronized(New Queue())
Dim QueueLock As New Object
...
Me._SerialCommunicationThread = New Thread(AddressOf THREAD_SerialCommunication)
Me._SerialCommunicationThread.Priority = ThreadPriority.AboveNormal
Me._SerialCommunicationThread.Start()
Private Sub THREAD_SerialCommunication()
'comm port new instace, settings, start, etc
do
' copy all commport's existing bytes to rec_buffer
' parse data in rec_buffer ( my own protocol, every message has 14bytes, last is CRC sum), copy valid message (14 baytes) to buffer_work
if (CRC is OK) then
SyncLock QueueLock 'lock queue for adding message
Me._DataQueue.Enqueue(buffer_work) ' add message
'Console.WriteLine(received_messages_counter & " ID: " & buffer_work(4) & " val:" & buffer_work(5))
'buffer_work(4) is message ID byte
'buffer_work(5) is value byte
End SyncLock
end if
loop
End sub
...
'UI main thread
Private Sub Timer1_Tick ' interval=10ms
while Form1._DataQueue.Count > 0 Then
SyncLock QueueLock
buf_can = Form1._DataQueue.Dequeue()
'Console.WriteLine(received_messages_counter2 & " ID: " & buffer_work(4) & " val:" & buffer_work(5)
End SyncLock
end while
end sub
I'm sending data to COM port from microcontroler:
for(i=0,i<50;++i)
{
send_message(ID_100,i); // send message with ID=100 and data=i
send_message(ID_201,i);
send_message(ID_202,i);
};
And till parsing procedure and adding to queue console in commport thread writes exactly what is send and copy of message in buffer_work is enqueue:
1 ID: 100 val:0
2 ID: 200 val:0
3 ID: 201 val:0
4 ID: 100 val:1
5 ID: 200 val:1
6 ID: 201 val:1
...
148 ID: 100 val:49
149 ID: 200 val:49
150 ID: 201 val:49
but here comes the problem, the UI thread gives:
...
131 ID: 201 val:43
132 ID: 201 val:43
133 ID: 200 val:44
134 ID: 200 val:44
135 ID: 200 val:45
136 ID: 200 val:45
137 ID: 200 val:45
138 ID: 100 val:46
139 ID: 100 val:46
140 ID: 100 val:47
141 ID: 100 val:47
142 ID: 100 val:47
143 ID: 100 val:48
144 ID: 100 val:48
145 ID: 100 val:48
146 ID: 201 val:48
147 ID: 201 val:48
148 ID: 201 val:49
149 ID: 201 val:49
150 ID: 201 val:49
so I get exactly 150 messages but it looks like queue is enqueue in strange way...adding the same message several times, not exactly what is in buffer_work...and at the end of transmision I should have 3x49 values at 100,201 and 202 ID, but it isn't.
I thought that fifo queue behaves like enqueue A,B,C and I dequeue getting C,B,A. OK, it works but when I enqueue all messages and after that I dequeue.
When I add conditional in main UI thread:
If Form1._DataQueue.Count = 150 Then
so waiting to enqueue all 150 parsed messages in comm thread, then console prints 150 same messages received in UI thread, those all are the last sent message
...
145 ID: 201 val:49
146 ID: 201 val:49
147 ID: 201 val:49
148 ID: 201 val:49
149 ID: 201 val:49
150 ID: 201 val:49
So queue looks like to be an 1-element queue, but I need that queue will be message buffer between commport thread and UI thread, so no messaged will be lost... even if UI thread will be activ for a little longer time...
Thank you for any help and tips how to solve this problem...
Regards!

REBOL Change the backdrop image and text

REBOL
I currently trying to redo a small app I made in Delphi.
This application displays a background image among n and a text among n, but I cannot change the image or the text, the change of image and text is done by the button >>.
This is the simplified code without the random part because I found out about it:
Rebol[
Title: "You have a message !"
Version: 1.0.0
Needs: [1.2.115]
]
the-imag1: load %"/C/MyFile/Cours CD/Affiche/Images/Vague9.jpg"
the-imag2: load %"/C/MyFile/Cours CD/Affiche/Images/Vague3.jpg"
the-image: the-imag1
text1: "Your banner text here"
view xx1: layout [
size the-image/size
b1: backdrop the-image
at b1/offset + 110x120
box 350x150 font-size 20 font-color black [align: 'center] text1
at b1/offset + 530x370
btn ">>" [the-image: the-imag2 ; new image
text1: "Hello" ; new text
show xx1] effect [multiply 90]
]
You are redefining the face, not just the content. Just redefine the field you need. Try this:
Rebol[
Title: "You have a message !"
Version: 1.0.0
Needs: [1.2.115]
]
the-imag1: load %"/C/MyFile/Cours CD/Affiche/Images/Vague9.jpg"
the-imag2: load %"/C/MyFile/Cours CD/Affiche/Images/Vague3.jpg"
the-image: the-imag1
text1: "Your banner text here"
view xx1: layout [
size the-image/size
b1: backdrop the-image
at b1/offset + 110x120
t1: text text1
at b1/offset + 530x370
btn ">>" [
b1/image: the-imag2 ; new image
t1/text: "Hello" ; new text
show xx1
] effect [multiply 90]
]

How to create a Popup Window in Rebol?

I tried to implement a save-as-ftp button in Rebol embedded editor. Implementation of the save-as-button is this:
save-as-ftp: has [file-content][
file-content: t1/text
prefs-file: rejoin [_self-path %ftp.preferences.txt]
either exists? prefs-file [
prefs-ftp: construct load prefs-file; see article application configuration file
user: prefs-ftp/user
password: prefs-ftp/password
server-path: prefs-ftp/server-path
][
user: ask "User: "
password: ask/hide "Password: "
server-path: ask "Server-Path: "
]
view ftp-view: layout [
origin 10x10 space 8x4
style btn btn 140
ftp-field: text bold "" 140 center
pad 0x4
btn-enter 140 "Save" #"s" [hide-popup result: ftp-field/text]
btn red + 50 "Quit - No Save" [hide-popup quit-now]
]
file-target: result
ftp-target: rejoin [ftp:// user ":" password "#" server-path file-target]
write ftp-target file-content
print ["uploaded" file-target "to" rejoin [ftp:// "XXXXXXX" ":" "XXXXXXX" "#" server-path]]
true
]
My problem is with view ftp-view : I cannot even type in ftp-field text box as the popup window loses focus.
hide-popup is used to close a modal window.
A modal window is opened by using 'inform
I don't see any modal windows here.
Oh .. this is a button or something that you are attaching to the rebol editor?
I modified mine some years ago to edit ftp files ... I'll have to see if I can find what I did.