google / access-bridge-explorer

Explore accessibility tree of Java Access Bridge enabled applications
Apache License 2.0
118 stars 52 forks source link

Trying to select a value in combobox changes the selection but change is not triggered. #7

Open Nfactor26 opened 7 years ago

Nfactor26 commented 7 years ago

I am trying to automate UI of "FileChooserDemo.jar" application distributed with jdk-8u121-windows-x64-demos. There is a button on the UI "Show FileChooser". There is a drop down labelled "Look and Feel" on this application. Possible values are "Metal","Nimbus","Windows",etc. I am selecting the "Windows" options using following code :

//targetControl is AccessibleContextNode and has been looked up already
 targetControl.AccessBridge.Functions.ClearAccessibleSelectionFromContext(targetControl.JvmId, targetControl.AccessibleContextHandle);          

//index is the position of "Windows" in the dropdown
          targetControl.AccessBridge.Functions.AddAccessibleSelectionFromContext(targetControl.JvmId, targetControl.AccessibleContextHandle, index);

Expected behavior : Theme of the application should change to selected value in drop down like it happens when manually making the selection using mouse.

Current behavior : Theme of the application doesn't change. Also, changing the value in drop down now manually using mouse has no effect on UI.

Regards, Nish26

01vadim10 commented 6 years ago

Hi, @Nfactor26! I have the same problem with ComboBox in SwingSet2 from JDK demo samples. Did you solve it?

Nfactor26 commented 6 years ago

No. I spent several hours but could not get it working . Since i had the dropdown control and option control already looked up , i retrieved their bounding box and then used mouse simulation to actually move the mouse and perform click on dropdown control followed by option to select.

rpaquay commented 6 years ago

Have you tried calling the "click" action on the newly selected item of the combo box? (using the DoAccessibleActions method).

01vadim10 commented 6 years ago

@rpaquay yes. I tried all possible ways to add selection item to ComboBox. I used to

  1. AddAccessibleSelectionFromContext()
  2. Created RequestFocus() for different items(ComboBox, List, ListItem)
  3. Actions for ComboBox and ListItem(label).

About "click". It works similarly to AddAccessibleSelectionFromContext() method, after DoAccessibleActions() list item would be selected but action "click" doesn't occur

thikon commented 4 years ago

Does anyone know what is the solution?

Srivasanthioruganti commented 4 years ago

Events_PropertySelectionChange is being triggered whenever we try to change the selection in the combo box,but is there any specific event that will capture once the value is changed in the combo box. Anyone have a solution,Please let me know how to capture the data every time value is changed in the combo box.

thikon commented 4 years ago

For selected index on combobox please try to use Functions.AddAccessibleSelectionFromContext()

void AddAccessibleSelectionFromContext(int vmid, JavaObjectHandle asel, int i)

int i -> means index of value in combobox.

AngelinaPl commented 3 years ago

After calling AddAccessibleSelectionFromContext(int vmid, JavaObjectHandle asel, int i) you should simulate key stroke AccessibleKeyCode.ACCESSIBLE_VK_ENTER. It works for me.