API Calling Mechanism
Following are the steps to call APIs:
- Invoke Mapping Server – You need to invoke mapping server before start any automation. You can invoke it by creating instance of MappingServer class and calling its method InvokeMappingServer.
e.g. MappingServer mServer=new MappingServer()mServer.InvokeMappingServer();
- Set environment variable by using below method:
- For window_mode=EVENT_BASED
mServer.SetAgentJarEnvVariable(MappingServer.WindowMode.EVENT_BASED) - For window_mode=WINDOW_CLASS_BASED
mServer.SetAgentJarEnvVariable(MappingServer.WindowMode.WINDOW_CLASS_BASED)
- For window_mode=EVENT_BASED
- Launch application.
- Get port no. using below method by passing process id of the launched application -
mServer. GetPortNoForPID(string PID)
- Create instance of JavaAutomationAPI class and call any API you want. JavaAutomationAPI class is used to automate different types of Java thick client applications like awt, swing, applet, jnlp (URL based applications), javafx etc. You can call any API listed in this topic-
JavaAutomationAPI proxy=new JavaAutomationAPI(PID);proxy.click(string searchPath);