Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# - System.Windows.Automation with Java, Java Access Bridge with WindowsAccessBridge.dll

C# - System.Windows.Automation with Java, Java Access Bridge with WindowsAccessBridge.dll

Scheduled Pinned Locked Moved C#
csharpjavacomtestingtools
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gagy379
    wrote on last edited by
    #1

    Hello, I need to do some gui automation work with Java from C#. I apologize, there are two ways: 1/ throught .net 3.0 System.Windows.Automation, It seems to be incompatible with Java. 2/ throught Java Access Bridge throught interop with functions in WindowsAccessBridge.dll However, all called functions /isJavaWindow, getAccessibleContextAt, getAccessibleContextFromHWND, getAccessibleContextWithFocus/ are not working for me. Does anybody have any examples ? Gagy

    J 1 Reply Last reply
    0
    • G gagy379

      Hello, I need to do some gui automation work with Java from C#. I apologize, there are two ways: 1/ throught .net 3.0 System.Windows.Automation, It seems to be incompatible with Java. 2/ throught Java Access Bridge throught interop with functions in WindowsAccessBridge.dll However, all called functions /isJavaWindow, getAccessibleContextAt, getAccessibleContextFromHWND, getAccessibleContextWithFocus/ are not working for me. Does anybody have any examples ? Gagy

      J Offline
      J Offline
      John502
      wrote on last edited by
      #2

      Hi Greg, Please use below code using System.Runtime.InteropServices; using System; using System.Collections.Generic; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; namespace JabApiLib.JavaAccessBridge { public static class JabHelpers { public class AccessibleTreeItem { public String name; // the AccessibleName of the object public String description; // the AccessibleDescription of the object public String role; // localized AccesibleRole string public String role_en_US; // AccesibleRole string in the en_US locale public String states; // localized AccesibleStateSet string (comma separated) public String states_en_US; // AccesibleStateSet string in the en_US locale (comma separated) public Int32 indexInParent; // index of object in parent public Int32 childrenCount; // # of children, if any public Int32 x; // screen coords in pixel public Int32 y; // " public Int32 width; // pixel width of object public Int32 height; // pixel height of object public Boolean accessibleComponent; // flags for various additional public Boolean accessibleAction; // Java Accessibility interfaces public Boolean accessibleSelection; // FALSE if this object doesn't public Boolean accessibleText; // implement the additional interface public Boolean accessibleInterfaces; public string textValue; public string m_msgStr; public List children; public AccessibleTreeItem() { children = new List(); } public AccessibleTreeItem(AccessibleContextInfo accessibleContextInfo) : this() { this.name = accessibleContextInfo.name; // the AccessibleName of the object this.description = accessibleContextInfo.description; // the AccessibleDescription of the object this.role = accessibleContextInfo.role; // localized AccesibleRole string this.role_en_US = accessibleContextInfo.role_en_US; // AccesibleRole string in the en_US locale this.states = accessibleContextInfo.states; // localized AccesibleStateSet string (comma separated) this.states_en_US = accessibleContextInfo.state

      V 1 Reply Last reply
      0
      • J John502

        Hi Greg, Please use below code using System.Runtime.InteropServices; using System; using System.Collections.Generic; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; namespace JabApiLib.JavaAccessBridge { public static class JabHelpers { public class AccessibleTreeItem { public String name; // the AccessibleName of the object public String description; // the AccessibleDescription of the object public String role; // localized AccesibleRole string public String role_en_US; // AccesibleRole string in the en_US locale public String states; // localized AccesibleStateSet string (comma separated) public String states_en_US; // AccesibleStateSet string in the en_US locale (comma separated) public Int32 indexInParent; // index of object in parent public Int32 childrenCount; // # of children, if any public Int32 x; // screen coords in pixel public Int32 y; // " public Int32 width; // pixel width of object public Int32 height; // pixel height of object public Boolean accessibleComponent; // flags for various additional public Boolean accessibleAction; // Java Accessibility interfaces public Boolean accessibleSelection; // FALSE if this object doesn't public Boolean accessibleText; // implement the additional interface public Boolean accessibleInterfaces; public string textValue; public string m_msgStr; public List children; public AccessibleTreeItem() { children = new List(); } public AccessibleTreeItem(AccessibleContextInfo accessibleContextInfo) : this() { this.name = accessibleContextInfo.name; // the AccessibleName of the object this.description = accessibleContextInfo.description; // the AccessibleDescription of the object this.role = accessibleContextInfo.role; // localized AccesibleRole string this.role_en_US = accessibleContextInfo.role_en_US; // AccesibleRole string in the en_US locale this.states = accessibleContextInfo.states; // localized AccesibleStateSet string (comma separated) this.states_en_US = accessibleContextInfo.state

        V Offline
        V Offline
        vishnukamath
        wrote on last edited by
        #3

        Hi , How to click a button using Java Access Bridge with WindowsAccessBridge.dll (C#.net). Please share me complete code for below two classes. 1)AccessibleActionsToDo 2)AccessibleActions AccessibleActionsToDo actions_to_do; int temp2 = Marshal.SizeOf(new AccessibleActions()); IntPtr accessible_action_ptr = Marshal.AllocHGlobal(temp2); JabApi.getAccessibleActions(vmID, currentPtr, accessible_action_ptr); AccessibleActions actions1 = (AccessibleActions)Marshal.PtrToStructure(accessible_action_ptr, typeof(AccessibleActions)); actions_to_do.actionsCount = actions1.actionsCount; actions_to_do.actions = actions1.actionInfo; int temp3 = Marshal.SizeOf(new AccessibleActionsToDo()); IntPtr accessible_action_ptr1 = Marshal.AllocHGlobal(temp3); JabApi.MouseClickedDelegate mcd1 = new JabApi.MouseClickedDelegate(HandleMouseClicked); int fp = 0; JabApi.setMouseClickedFP(null); Marshal.StructureToPtr(actions_to_do, accessible_action_ptr1, false); JabApi.doAccessibleActions(vmID, currentPtr, accessible_action_ptr1, &failure); IntPtr Window_Handle = JabApi.getHWNDFromAccessibleContext(vmID, currentPtr);

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups