Clicking a Button using Autoit Not working

1,824 views
Skip to first unread message

Usman Hussain

unread,
Sep 23, 2010, 4:09:48 AM9/23/10
to Watir General
Hi Guys,

Im having trouble trying to hit a button at the moment using Autoit.
The main problem is, if you were to tab around the screen you can
never get focus on it.

The pop up is in a firefox window, so its more like a browser pop up
with window (hence why im using autoit) characteristics.

Im using UI Spy to locate the elements when ever i use Autoit.

At the moment my code looks like this:
require 'rubygems'
require 'win32ole'
require 'watir-webdriver'

autoit = WIN32OLE.new('AutoITX3.Control')
autoit.WinActivate('Mozilla Firefox')
autoit.Send('{TAB}')
autoit.Send('{TAB}')
autoit.Send('/content/story/jackpotjoy/video_test99')
autoit.ControlClick("Mozilla Firefox","","OK")
puts 'This is working'

so im able to enter in text into the browser field but then the OK and
Cancel button i cannot click because there is no focus on them.
the line autoit.ControlClick("Mozilla Firefox","","OK") does not seem
to do anything... im not sure have i written it incorrectly?

The UISpy properties for the OK button are:

AutomationElement
General Accessibility
AccessKey: ""
AcceleratorKey: ""
IsKeyboardFocusable: "False"
LabeledBy: "(null)"
HelpText: ""

State
IsEnabled: "True"
HasKeyboardFocus: "False"

Identification
ClassName: ""
ControlType: "ControlType.Text"
Culture: "(null)"
AutomationId: ""
LocalizedControlType: "text"
Name: "OK"
ProcessId: "5828 (firefox)"
RuntimeId: "42 10880700 2 4 0 0"
IsPassword: "False"
IsControlElement: "True"
IsContentElement: "True"

Visibility
BoundingRectangle: "(1875, 722, 17, 13)"
ClickablePoint: "(null)"
IsOffscreen: "False"

ControlPatterns
Invoke

can anyone help me out on this? please let me know if you need any
more help...

Usman Hussain

unread,
Sep 23, 2010, 4:16:17 AM9/23/10
to Watir General
Also te properties shown above are for the text on the button (the OK
button)
here are the properties for the whole button... its less information
that the one above but it might help you guys help me solve this~????

button properties:
AutomationElement
General Accessibility
AccessKey: ""
AcceleratorKey: ""
IsKeyboardFocusable: "False"
LabeledBy: "(null)"
HelpText: ""

State
IsEnabled: "True"
HasKeyboardFocus: "False"

Identification
ClassName: ""
ControlType: "ControlType.Custom"
Culture: "(null)"
AutomationId: ""
LocalizedControlType: ""
Name: ""
ProcessId: "5828 (firefox)"
RuntimeId: "42 24184740 2 4 0"
IsPassword: "False"
IsControlElement: "True"
IsContentElement: "True"

Visibility
BoundingRectangle: "(1864, 720, 37, 17)"
ClickablePoint: "(null)"
IsOffscreen: "False"

ControlPatterns
Invoke

Jarmo Pertman

unread,
Sep 25, 2010, 4:15:19 AM9/25/10
to Watir General
I'm not sure that this button is a regular Windows control (http://
msdn.microsoft.com/en-us/library/bb773173(VS.85).aspx) you could try
to send and Enter key there which should trigger the OK if the window
itself is programmed correctly :)

Jarmo
Reply all
Reply to author
Forward
0 new messages