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.
]]>The post UI Automation | Advance Script With OR appeared first on TestMate.
]]>Setup:
Repository
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
<Objects>
<ky_Main>Window,Name::Form1
<ky_TabControl>Tab,AutomationId::tabControl1<ky_TabPage1>TabItem,Name::tabPage1</ky_TabPage1><ky_TabPage2>TabItem,Name::tabPage2</ky_TabPage2><ky_TabPage3>TabItem,Name::tabPage3</ky_TabPage3><ky_TabPane>Pane<ky_Tree>Tree</ky_Tree><ky_DataGrid>Table,AutomationId::dataGridView1</ky_DataGrid><ky_Checkbox1>CheckBox,AutomationID::checkBox1</ky_Checkbox1><ky_RadioButton1>RadioButton,AutomationID::radioButton1</ky_RadioButton1><ky_RadioButton2>RadioButton,AutomationID::radioButton2</ky_RadioButton2></ky_TabPane></ky_TabControl>
<ky_Textbox1>Edit,AutomationID::textBox1</ky_Textbox1>
<ky_Popup>Window<ky_OK_Button>Button,Name::OK</ky_OK_Button></ky_Popup>
<ky_Toolstrip1>Toolbar,Name::toolStrip1
<ky_Button1_TS>Button,Name::btn1</ky_Button1_TS><ky_List1>ComboBox</ky_List1></ky_Toolstrip1>
<ky_Button1>Button,Name::button1</ky_Button1>
</ky_Main>
</Objects>
VBScript
'Launch the app if not already launched.
If Not(uia.Exist("ky_Main")) Then
hwnd = util.StartApp("C:\Testmate\Sample\SampleTest.exe")
End If
'uia.SetRoot "ky_Main"
uia.SetRoot hwnd
'Select the tab
uia.Select("ky_TabPage1")
' Click on the button
uia.Click "ky_Button1"
'Fail the step if Popup Appears - Explicit failure for demonstration
If uia.Exist("ky_OK_Button",3) Then
Logger.Fail "Step 1", "Popup has been displayed", True
uia.Click "ky_OK_Button"
End If
'Set the Textbox value
uia.SetValue "ky_Textbox1" ,cstr(Time)
'Toggle the checkbox
uia.Toggle("ky_Checkbox1")
'Validate the Checkbox is checked
If uia.GetLegacyProperty("ky_Checkbox1","state")="1048596" Then
'Report the passed step
Logger.Pass "Step 2", "checkbox checked"
Else
'Report failure
Logger.Fail "Step 2", "checkbox checked",True
End If
'Click on radio button 2
uia.Click("ky_RadioButton2")
'Select Tab 2
uia.Select "ky_TabPage2"
'Perform Expand node operations on the the tree view
uia.ExpandTreeNode "ky_Tree" ,"Node0"
uia.ExpandTreeNode "ky_Tree" ,"Node0;Node2"
uia.ExpandTreeNode "ky_Tree", "Node0;Node2;Node3"
'Perform Select Node Operation
uia.SelectTreeNode "ky_Tree", "Node0;Node2;Node3"
uia.SelectTreeNode "ky_Tree", "Node0;Node2"
uia.SelectTreeNode "ky_Tree" ,"Node0;Node2;Node3"
uia.SelectTreeNode "ky_Tree", "Node0;Node2"
uia.SelectTreeNode "ky_Tree", "Node0;Node2;Node3"
uia.SelectTreeNode "ky_Tree", "Node0;Node2"
uia.SelectTreeNode "ky_Tree", "Node0;Node2;Node3"
uia.SelectTreeNode "ky_Tree", "Node0;Node2"
'Perform Expand select node operation
uia.ExpandTreeNode "ky_Tree", "Node1"
uia.SelectTreeNode "ky_Tree", "Node1;Node17"
'Collapse all the tree nodes
uia.CollapseTreeNode "ky_Tree", "Node0"
uia.CollapseTreeNode "ky_Tree", "Node0;Node2"
uia.CollapseTreeNode "ky_Tree", "Node0;Node2;Node3"
uia.CollapseTreeNode "ky_Tree", "Node1"
'Select Value from the List view
uia.SelectFromDropDown "ky_List1" ,"Third"
'Select Third Tab
uia.Select "ky_TabPage3"
'Set the values in data grid
uia.SetCellData "ky_DataGrid", 1,1 ,Cstr(Time)
uia.SetCellData "ky_DataGrid",1,2 ,"Test"
uia.SetCellData "ky_DataGrid",1,3 ,Cstr(Time)
'Select The Tab
uia.Select("ky_TabPage1")
'Click on the button 1
uia.Click "ky_Button1"
'Handle popup
If uia.Exist("ky_OK_Button",3) Then
'Click Ok
uia.Click "ky_OK_Button"
End If
'Set the Textbox value
uia.SetValue "ky_Textbox1" ,cstr(Time)
'Toggle the checkbox
uia.Toggle("ky_Checkbox1")
'Validate the Checkbox is not checked
If uia.GetLegacyProperty("ky_Checkbox1","state")="1048596" Then
'Report the passed step
Logger.Fail "Step 3", "checkbox checked"'
Else
'Report failure
Logger.Pass "Step 3", "checkbox checked",True
End If
'Click on radio button 2
uia.Click("ky_RadioButton2")
'Select Tab 2
uia.Select "ky_TabPage2"
'Perform Expand node operations on the the tree view
uia.ExpandTreeNode "ky_Tree" ,"Node0"
uia.ExpandTreeNode "ky_Tree" ,"Node0;Node2"
uia.ExpandTreeNode "ky_Tree", "Node0;Node2;Node3"
'Perform Select Node Operation
uia.SelectTreeNode "ky_Tree", "Node0;Node2;Node3"
uia.SelectTreeNode "ky_Tree", "Node0;Node2"
uia.SelectTreeNode "ky_Tree" ,"Node0;Node2;Node3"
uia.SelectTreeNode "ky_Tree", "Node0;Node2"
uia.SelectTreeNode "ky_Tree", "Node0;Node2;Node3"
uia.SelectTreeNode "ky_Tree", "Node0;Node2"
uia.SelectTreeNode "ky_Tree", "Node0;Node2;Node3"
uia.SelectTreeNode "ky_Tree", "Node0;Node2"
'Perform Expand an select node operation
uia.ExpandTreeNode "ky_Tree", "Node1"
uia.SelectTreeNode "ky_Tree", "Node1;Node17"
'Collapse all the tree nodes
uia.CollapseTreeNode "ky_Tree", "Node0"
uia.CollapseTreeNode "ky_Tree", "Node0;Node2"
uia.CollapseTreeNode "ky_Tree", "Node0;Node2;Node3"
uia.CollapseTreeNode "ky_Tree", "Node1"
'Select Value from the List view
uia.SelectFromDropDown "ky_List1" ,"Third"
'Select Third Tab
uia.Select "ky_TabPage3"
'Set the values in data grid
uia.SetCellData "ky_DataGrid", 1,1 ,Cstr(Time)
uia.SetCellData "ky_DataGrid",1,2 ,"Test"
uia.SetCellData "ky_DataGrid",1,3 ,Cstr(Time)
'Reset the root
uia.ResetRoot
'Close the Window
uia.CloseWindow "ky_Main"
The post UI Automation | Advance Script With OR appeared first on TestMate.
]]>The post Blog Post Title appeared first on TestMate.
]]>Use your company’s blog posts to opine on current industry topics, humanize your company, and show how your products and services can help people.
The post Blog Post Title appeared first on TestMate.
]]>