The post Automate Java Swing Application appeared first on TestMate.
]]>The workflow starts on an already open Android Studio. It opens the Settings dialog from the File menu, performs some actions and closes it.
Any open source Object spy can be used to find object properties. Google acess bridge explorer can be a good option to spy objects.
'Open Settings Dialog from File Menu
java.VirtualClick("Role::frame,Name::r|My Application.*>==>Role::menu,Name::File")
java.Click("Role::frame,Name::r|My Application.*>==>Name::Settings...")
'Wait for Settings To Open - Polling wait for 20 seconds
bSync = java.Exist("Role::dialog,Name::Settings",20)
'Validate the presence of Settings Window
If bSync Then
Call Logger.Pass("Step 1","Dialog is present", True)
Else
Call Logger.Fail("Step 1","Dialog is not present", True)
End If
'Select Appearance node from Appearance & Behavior
Call java.SelectTreeNode("Role::dialog,Name::Settings>==>Role::tree","Name::Appearance & Behavior",0)
bSync = java.Exist("Role::dialog,Name::Settings>==>Role::combo box,Name::Theme:",20)
'Select DropDown Values
Call java.SelectFromCombobox("Role::dialog,Name::Settings>==>Role::combo box,Name::Theme:",1)
Call java.SelectFromCombobox("Role::dialog,Name::Settings>==>Role::combo box,Name::IDE:","Greyscale")
Call java.SelectFromCombobox("Role::dialog,Name::Settings>==>Role::combo box,Name::Editor:","Greyscale")
'Select Notifications tree Node
Call java.SelectTreeNode("Role::dialog,Name::Settings>==>Role::tree","Name::Appearance & Behavior",5)
bSync = java.Exist("Role::dialog,Name::Settings>==>Role::table,Visible::1",5)
'Validate the presence of notification Tables
If bSync Then
Call Logger.Pass("Step 1","Notifications table is present", True)
Else
Call Logger.Fail("Step 1","Notifications table is not present", True)
End If
'Check the required checkboxes in the table
'Since the Table object has already been located in the host in the previous step, we don need to pass it again
Call java.ClickTableCell(2,2)
Call java.ClickTableCell(4,2)
Call java.ClickTableCell(6,2)
Call java.ClickTableCell(7,2)
Call java.ClickTableCell(8,2)
Call java.ClickTableCell(9,2)
Call java.ClickTableCell(10,2)
Call java.ClickTableCell(11,2)
Call java.ClickTableCell(12,2)
Call java.ClickTableCell(13,2)
Call java.ClickTableCell(14,2)
Call java.ClickTableCell(15,2)
Call java.ClickTableCell(16,2)
Call java.ClickTableCell(17,2)
Call java.ClickTableCell(18,2)
Call java.ClickTableCell(19,2)
'Clic on the Popup cell and select Balloon
Call java.ClickTableCell(6,1)
util.Wait(100)
Call java.Click("Role::window>==>Name::Balloon")
'Click on Cancel button
'Virtyual click does not need mouse movement, but it is supported only by limited element types
Call java.VirtualClick("Role::dialog,Name::Settings>==>Role::push button,Name::Cancel")
The post Automate Java Swing Application appeared first on TestMate.
]]>