Unit Test in the Windows OS NRE

The WinAppDriver linkage function uses the UIAutomation interface provided by the Nexacro Platform 17 to read or write properties of apps running in NRE and to support methodological execution by specifying parameters. You can write unit tests and test using UI automation testing tools, such as Selenium.

In this chapter, we will look at the steps to install the WinAppDriver, create basic C# and Java projects in Visual Studio and Eclipse, and connect them to the Nexacro Platform apps.

WinAppDriver operates in Windows 10 or later environments.

https://github.com/Microsoft/WinAppDriver#system-requirements

The WinAppDriver linkage function is supported only in version 17.0.0.1500 or later.

If yours is not the supported version, please update the Nexacro Platform.

Configuring the WinAppDriver Linkage

Installing the WinAppDriver

1

Enable "Developer Mode" in the Windows operating system [Settings > Use Developer Features].

If you are enabling developer mode for the first time, the operating system configuration may take some time. Please allow some time to enable the mode.

2

Download the WinAppDriver installation file (WindowsApplicationDriver.msi).

https://github.com/Microsoft/WinAppDriver

https://github.com/Microsoft/WinAppDriver/releases

3

Run the downloaded installation file (WindowsApplicationDriver.msi) to install the WinAppDriver.

4

Run the WinAppDriver with administrator privileges from the installation path.

The general installation path is as follows.

C:\Program Files (x86)\Windows Application Driver\

5

Check if it runs normally.

If you want to change the ip, port settings, then execute the following.

> WinAppDriver.exe [ip] [port]

Installing the Development Tools

Unit test projects can be created using the C# or Java languages.

Installing Visual Studio

In the case of using the C# language and Visual Studio not being installed, you can install the development tool provided for free.

1

Download the Visual Studio community installation file (vs_community__xxxx.xxxx.exe).

Visual Studio Community

https://visualstudio.microsoft.com/vs/community/

2

Run the downloaded installation file (vs_community__xxxx.xxxx.exe) to install Visual Studio.

It may take some time to download the required package during installation. Please allow some time before proceeding with the installation.

3

Select the "Universal Windows Platform development" from the Workloads item and then proceed with the installation.

The development environment can also be added following installation.

A window to log in to your Microsoft account is displayed, but you can still test without logging in.

Installing Eclipse

In the case of using the Java language and Eclipse not being installed, you can install the development tool provided for free.

1

Download the Eclipse installation file (eclipse-inst-win64.exe).

eclipse.org

https://www.eclipse.org/downloads/

2

Run the downloaded installation file (eclipse-inst-win64.exe) to install Eclipse.

3

Select the "Java Developers" item from the development type selection step.

Creating & Running a Unit Test

Creating & Deploying the Nexacro Platform App

Create and deploy a simple Nexacro Platform app.

You can skip this step if you are going to use the Nexacro Platform app that has already been installed.

1

Run Nexacro Studio.

2

Create a project and a simple form screen.

Place only the Button component and the Edit component on the screen.

3

Write the onclick event function of the Button component.

When the Button component onclick event occurs, change the value property value in the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	this.Edit00.set_value("BUTTON CLICK");
};

4

Select the menu [Deploy > Packing (Archive&Update)] item and then create an archive file to be deployed.

Set the Update Type to "Local" so that it can run without a server connection.

5

Click the [Packing] button to create the archive file and then click the [Build App] button.

6

Click the [Build] button in the Build App window to create the installation file.

7

Run the created installation file to install the Nexacro Platform app.

Creating a Unit Test Project

Creating a Unit Test Project in Visual Studio

1

Run Visual Studio.

2

Select the "Unit Test Project" from the New Project to create a new project.

3

Install the Appium WebDriver library.

Select the menu [Project > Manage NuGet Package] and then enter "Appium" in the search window to check the Appium WebDriver library in the search results. Click the [Install] button to install the library.

4

Check the Selenium related package in the Updates tab.

If the latest version is installed, then the code may not work. If you have the latest version, please conduct the minor upgrade to version 3.0.1.

https://github.com/Microsoft/WinAppDriver/issues/497

5

Modify the created C# source code file as follows.

Modify the settings related to the Nexacro Platform app through the code below. Modify the pathway where the app is installed, the path to the nexacro.exe executable file, and the nexacro.exe execution option to match the actual installation path.


value

WindowsApplicationDriverUrl

http://127.0.0.1:4723/

NexacroAppDr

C:\\Program Files\\nexacro\\17\\app0201

NexacroAppId

C:\\Program Files\\nexacro\\17\\app0201\\nexacro.exe

NexacroAppAg

-k 'UnitTest' -s 'C:\\Program Files\\nexacro\\17\\app0201\\app0201\\start.json'
using System;
using System.Threading;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium.Remote;

namespace UnitTestProject1
{
	[TestClass]
	public class NexaTestSession
	{
		// winappdriver url
		protected const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723/";
		// app path
		private const string NexacroAppDr = "C:\\Program Files\\nexacro\\17\\app0201";
		// nexacro.exe path
		private const string NexacroAppId = "C:\\Program Files\\nexacro\\17\\app0201\\nexacro.exe";
		// nexacro.exe argument
		private const string NexacroAppAg = "-k 'UnitTest' -s 'C:\\Program Files\\nexacro\\17\\app0201\\app0201\\start.json'";
		// search root
		private const string FindNexacro = "Root";
		// OS/Device
		private const string TestOs = "Windows";
		private const string TestDevice = "WindowsPC";

		// Session Object : WindowsDriver 
		protected static WindowsDriver<WindowsElement> session;

		// WinAppDriver Session Create
		[ClassInitialize]
		public static void Setup(TestContext context)
		{
			// Launch a new instance of nexacro application or find nexacro application
		}

		// WinAppDriver Session Delete
		public static void TearDown()
		{
            // Close the application and delete the session
            if (session != null)
            {
                // Close Session – Close Application
                session.Close();
                // Quit Session
                session.Quit();
                // Delete Session
                session = null;
            }
		}

		[TestMethod]
		public void Test_Session()
		{
            Debug.WriteLine("session:" + session);
            Debug.WriteLine("session.SessionId:" + session.SessionId);
		}
	}
}

6

Run the Nexacro Platform app and add code to create the session.

Modify the Setup method in the code above as follows.

// WinAppDriver Session Create
[ClassInitialize]
public static void Setup(TestContext context)
{
	// Launch a new instance of nexacro application or find nexacro application
	if (session == null)
	{
		// Create a new session to launch nexacro application
		DesiredCapabilities appCapabilities = new DesiredCapabilities();
		TimeSpan time = new TimeSpan(0, 0, 10);

		// Launch Nexacro
		appCapabilities.SetCapability("app", NexacroAppId);
		appCapabilities.SetCapability("appArguments", NexacroAppAg);
		appCapabilities.SetCapability("appWorkingDir", NexacroAppDr);
		appCapabilities.SetCapability("platformName", TestOs);
		appCapabilities.SetCapability("deviceName", TestDevice);

		// Request Remote WinAppDriver Service
	session = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities, time);

		// Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most three times
		session.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0.5));
		Thread.Sleep(TimeSpan.FromSeconds(1.0));
	}
}

A timeout error may occur depending on the TimeSpan setting value. In that case, change the setting value as follows and proceed with the test.


TimeSpan time = new TimeSpan(0, 0, 30);

7

Select the menu [Test > Run > All Tests] item to proceed with the test. You can see that the installed app is running.

You can check the access information and session being created on the console screen where the WinAppDriver was executed.

8

You can check the successful test information in the Visual Studio test explorer.

Creating the Unit Test Project in Eclipse

1

Run Eclipse.

2

Select the menu [File > New > Java Project] and create a new project.

3

Download the required library and unzip the compressed file (.zip).

Library

Download Path

Appium Client Libraries

http://appium.io/downloads.html

java-client-7.0.0.jar

Selenium Client

https://www.seleniumhq.org/download/

selenium-java-3.141.59.zip

Apache Commons Lang

http://commons.apache.org/proper/commons-lang/download_lang.cgi

commons-lang3-3.8.1-bin.zip

Download and install the Apache Commons Lang library when the following error occurs during execution.

It may not be necessary, depending on the development environment.

java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils

4

Add the JUnit library. Select the menu [Project > Properties > Java Build Path > Libraries] tab and then click the [Add Library] button.

5

Add the Appium, Selenium libraries. Click the [Add External JARs] button and add the JAR file from the downloaded library file.

6

Click the [Apply and Close] button to apply the changes.

7

Select the menu [File > New > Class] and then create a new class file. Only enter the Name item and do not modify other options.

8

Modify the created Java source code file as follows.

Modify the settings related to the Nexacro Platform app in the code below. Modify the pathway where the app is installed, the pathway to the nexacro.exe executable file, and the nexacro.exe execution option to match the actual installation pathway.


value

WindowsApplicationDriverUrl

http://127.0.0.1:4723/

NexacroAppDr

C:\\Program Files (x86)\\nexacro\\17\\app0201

NexacroAppId

C:\\Program Files (x86)\\nexacro\\17\\app0201\\nexacro.exe

NexacroAppAg

-k 'UnitTest' -s 'C:\\Program Files (x86)\\nexacro\\17\\app0201\\app0201\\start.json'
import org.junit.*;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebElement;
import io.appium.java_client.windows.WindowsDriver;
import java.util.concurrent.TimeUnit;
import java.net.URL;

public class UnitTest {

	// winappdriver url
	private String WindowsApplicationDriverUrl = "http://127.0.0.1:4723/";
	// app path
	private String NexacroAppDr = "C:\\Program Files (x86)\\nexacro\\17\\app0201";
	// nexacro.exe path
	private String NexacroAppId = "C:\\Program Files (x86)\\nexacro\\17\\app0201\\nexacro.exe";
	// nexacro.exe argument
	private String NexacroAppAg = "-k 'UnitTest' -s 'C:\\Program Files (x86)\\nexacro\\17\\app0201\\app0201\\start.json'";
	// search root
	// private String FindNexacro = "Root";

	// OS/Device
	private String TestOs = "Windows";
	private String TestDevice = "WindowsPC";

	// Session Object : WindowsDriver
	private static WindowsDriver<RemoteWebElement> session = null;
	

	@Before
	public void setUp() throws Exception {
		// Launch a new instance of nexacro application or find nexacro application
	}

	@After
	public void tearDown() throws Exception {
		if (session != null) {
			// Nexacro17Session.quit();
		}
	}

	@Test
    public void Test_01_Session()
    {
        System.out.println("session : " + session);
		System.out.println("session.SessionId : " + session.getSessionId());        
    }
}

9

Run the Nexacro Platform app and then add code to create the session.

Modify the Setup method in the code above as follows.

@Before
public void setUp() throws Exception {
	// Launch a new instance of nexacro application or find nexacro application
	try {
		// Create a new session to launch nexacro application
		DesiredCapabilities appCapabilities = new DesiredCapabilities();

		appCapabilities.setCapability("app", NexacroAppId);
		appCapabilities.setCapability("appArguments", NexacroAppAg);
		appCapabilities.setCapability("appWorkingDir", NexacroAppDr);
		appCapabilities.setCapability("platformName", TestOs);
		appCapabilities.setCapability("deviceName", TestDevice);

		// Request Remote WinAppDriver Service
		session = new WindowsDriver<RemoteWebElement>(new URL(WindowsApplicationDriverUrl), appCapabilities);
		session.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);

	} catch (Exception e) {
		e.printStackTrace();
	} finally {
	}
}

10

Select the menu [Run > Run As > JUnit Test] item to proceed with the test. You can see that the installed app is running.

You can check the access information and session being created on the console screen where the WinAppDriver was executed.

11

You can check the successful test information in the JUnit panel.

Running the Unit Test

1

Add the code to run the unit test as follows.

Find the Button component in the current session and then process the mouse click command.

$r_title(C#)
[TestMethod]
public void Test_Button()
{
	WindowsElement element = session.FindElementByAccessibilityId("mainframe.WorkFrame.form.Button00");
	Assert.IsNotNull(element);
	Thread.Sleep(TimeSpan.FromSeconds(0.1));
	element.Click();
}
$r_title(Java)
@Test
public void Test_Button() throws Exception {
	WebElement element = session.findElementByAccessibilityId("mainframe.WorkFrame.form.Button00");
	Assert.assertNotNull(element);
	Thread.sleep(1000);
	element.click();
}

2

When the test is run, the installed app is executed. You can see that the mouse cursor is placed on the Button component and the click command is executed.

Checking the AccessibilityId Property Value

To access the component or control, the FindElementByAccessibilityId method is used, and you need to check the AccessibilityId property value at this time.

Checking the Component Property Value

The method to access the component itself placed on the form is as follows.

[MainFrame id property value].[ChildFrame id property value].form.[Component id property value]

To get the element of the Button component with the id property value being "Button00", write the following code.

$r_title(C#)

WindowsElement element = session.FindElementByAccessibilityId("mainframe.ChildFrame00.form.Button00");

Components placed in the Div component can be accessed as follows.

$r_title(C#)

WindowsElement element = session.FindElementByAccessibilityId("mainframe.ChildFrame00.form.Div00.form.CheckBox00");

Checking the Control & the Item Property Values

For example, the dropbutton of the Combo component placed in the Div component can generate the element as below.

$r_title(C#)

WindowsElement element = session.FindElementByAccessibilityId("mainframe.ChildFrame00.form.Div00.form.Combo00.dropbutton");

To proceed with the unit test, you need to expand the dropdown list of the Combo component and then select the item. To expand the dropdown list, you need to access the ButtonControl in the Combo component and then check the property value of the control.

The control property value can be checked in the component overview by running Help (shortcut key F1) in the Nexacro Studio. You can check that the id property value of the button clicked to expand the dropdown list in the Combo component is "dropbutton".

Checking the Property Value with Inspect

Property values (sub-controls) that are not exposed in Help may be changed depending on the product version.

When the property value is changed, the written test may not work.

However, it does not tell you how to access Item 3 after expanding the dropdown list. In this case, you can use the tool called "Inspect". "Inspect" can be found in the installation pathway if Windows SDK is installed.

Inspect

https://docs.microsoft.com/en-us/windows/desktop/winauto/inspect-objects

1

Run the inspect.exe file in the Windows SDK installation pathway.

2

Run the Nexacro Platform and then move the mouse cursor to the desired location.

3

Click the dropdown button of the Combo component to expand the dropdown list.

4

Place the mouse cursor on the desired item area. As shown in the figure below, a borderline is displayed in the target area recognized by Inspect, and the related information is displayed in the Inspect window.

Various information is displayed, and the item to be used as the AccessibilityId property value among them is "AutomationId".

When selecting the 2nd item from the dropdown list, you can generate the element as shown below.

$r_title(C#)

WindowsElement element = session.FindElementByAccessibilityId("mainframe.ChildFrame00.form.Div00.form.Combo00.combolist.item_1");

The element corresponding to the item can be accessed after the dropdown list is expanded. If you try to access the item before expanding the list, then it will be processed as a test failure.

In the test code, find the dropbutton element first, process the mouse click event, and then access the desired item when the dropdown list is expanded.

$r_title(C#)

[TestMethod]
public void Test_00_FindElementItem()
{
	WindowsElement element = session.FindElementByAccessibilityId("mainframe.ChildFrame00.form.Div00.form.Combo00.dropbutton");
	Assert.IsNotNull(element);
	element.Click();
	Thread.Sleep(TimeSpan.FromSeconds(0.1));
	WindowsElement elementItem = session.FindElementByAccessibilityId("mainframe.ChildFrame00.form.Div00.form.Combo00.combolist.item_1");
	Assert.IsNotNull(elementItem);
	Debug.WriteLine("elementItem.Text:" + elementItem.Text);
}

Running the Demo Unit Test by Feature

You can download the Nexacro Platform app installation file and the Java and C# sample files to run demos by feature.

1

Access the address below in a web browser.

https://github.com/TOBESOFT-DOCS/sample_nexacroplatform_17_winappdriver

You can see 2 folders and 1 installation file.

2

Download the nexacro17_SetupRuntime_x86.exe file. Click the file name with the mouse to see the [Download] button.

3

Install the app by running the downloaded installation file. The app will be installed in the pathway below.

C:\Program Files (x86)\nexacro\17\app0201

4

Paste the C# and Java samples into the project created in the Unit Test Project.

5

Run the unit test and check if the unit test is processing normally.

Supported Interface

Not all SeleniumRC and Appium interfaces are supported.

Features that cannot be supported in the Nexacro Platform or are not supported in the WinAppDriver are excluded.

The items below can be used when the client does not support a separate interface and they are called directly from the web browser or are called using HttpWebResponse, etc.

HTTP

WebDriver

WinAppDriver

GET

/status

/status

GET


/sessions

GET

/session/{session id}/window

/session/:sessionId/window

GET

/session/{session id}/window/handles

/session/:sessionId/window/handles

POST

/session/{session id}/window/maximize

/session/:sessionId/window/maximize

Session

Creating a Session

Create the session with the winappdriver information and then run the app.

C#

session = new WindowsDriver(new Uri(WinAppDriverUrl), appCapabilities);

Java

session = new WindowsDriver(new URL(WindowsApplicationDriverUrl), appCapabilities);

Comm

POST /session { …capabilities json data… }

Ending a Session

End the session and then close the app.

C#

session.Quit();

Java

session.quit();

Comm

DELETE /session/:session_id

Some of the interfaces provided by the WinAppDriver are not supported in the Nexacro Platform.

Timeout

Setting a Timeout

Set the timeout value to be applied during the session operation.

C#

session.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0.5));

Java

session.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);

Comm

POST /session/:session_id/timeouts {"type":"implicit","ms":500.0}

Frame

Checking the Mainframe Information

Return the titletext property value of the MainFrame object.

C#

session.Title;

Java

session.getTitle();

Comm

GET /session/:sessionId/title

Window

Changing the Enabled Window

Change the current window. Windowhandle can be obtained from session.WindowHandles. For the initial execution, the MainFrame object is set as the current window.

C#

session.SwitchTo().Window(session.WindowHandles[0]);

Java

Set<String> handles = session.getWindowHandles();
Set handles = session.getWindowHandles();

Comm

POST /session/:sessionId/window {"name":"0x000A12BC"}

Ending the Enabled Window

End the current window.

C#

session.Close();

Java

session.close();

Comm

DELETE /session/:sessionId/window

Obtaining the Enabled Window Handle

Return the current window handle object.

C#

handle = session.CurrentWindowHandle;

Java

Handle = session.getWindowHandle();

Comm

GET /session/:sessionId/window_handle

Obtaining the Window Handle Array

Return all window handle objects as an array.

C#

handlearray = session.WindowHandles;

Java

Set handles = session.getWindowHandles();

Comm

GET /session/:sessionId/window_handles

Checking the Window Size Information

Return the window size in the form of the Size object.

C#

session.Manage().Window.Size;

Java

session.getWindowHandles().size()

Comm

GET /session/:sessionId/window/:windowHandle/size

Changing the Window Size

Change the window size.

C#

session.Manage().Window.Size = new Size(width,height);

Java

session.manage().window().setSize(new Dimension(width, height));

Comm

POST /session/:sessionId/window/:windowHandle/size

Checking the Window Position Information

Return the window position in the form of the Point object.

C#

point = session.Manage().Window.Position;

Java

point = session.manage().window().getPosition()

Comm

GET /session/:sessionId/window/:windowHandle/position

Changing the Window Position

Change the window coordinates.

C#

session.Manage().Window.Position = new Point(left,top);

Java

session.manage().window().setPosition(new Point(left, top))

Comm

POST /session/:sessionId/window/:windowHandle/position

Maximizing the Window

Maximize the window size.

C#

session.Manage().Window.Maxmize();

Java

session.manage().window().maximize();

Comm

POST /session/:sessionId/window/:windowHandle/maximize

Element

Element is the smallest unit of the WinAppDriver operation. In the Nexacro Platform, nexacro Element, which is the element of components and controls, is processed as Element.

ControlElement surrounds the component and Elements, such as ContainerElement, InputElement, IconTextElement, TextElement, are located inside. In the case of the Button component, it is configured as follows.

Obtaining the Element

Return the ControlElement object of the component and control.

C#

element = session.FindElementByAccessibilityId("mainframe.ChildFrame00.form.Button00");

Java

element = session.findElementByAccessibilityId("mainframe.ChildFrame00.form.Button00");

Comm

POST /session/:sessionId/element 
{ "using":"accessibilityid", "value":"mainframe.ChildFrame00.form.Button00" }

In the case of the objParentFrame parameter value set to null when executing the open method in the Nexacro Platform, it is accessed based on the ChildFrame ID.

$r_title(C#)
// When specifying parent null: nexacro.open("openframe", url, null, ...) 
nexaButton00 = session.FindElementByAccessibilityId("openframe.form.Button00");

// When specifying parent frame: nexacro.open("openframe", url, ownerframe, ...)
nexaButton00 = session.FindElementByAccessibilityId("mainframe.ChildFrame00.openframe.form.Button00");

Obtaining the Element Array

Return the ControlElement object list of component and control as an array value.

C#

element = session.FindElementsByAccessibilityId("mainframe.ChildFrame00.form.Button00");

Java

element = session.findElementsByAccessibilityId("mainframe.ChildFrame00.form.Button00");

Comm

POST /session/:sessionId/elements 
{ "using":"accessibilityid", "value":"mainframe.ChildFrame00.form.Button00" }

Checking the Element id Value

Return the id value of the WinAppDriver Element.

C#

id = element.Id;

Java

id = element.getTagName()

Comm

GET /session/:sessionId/element/:id/name

Checking the Text Information Displayed on Element

Return the text value of Element.

C#

text = element.Text;

Java

text = element.getText();

Comm

GET /session/:sessionId/element/:id/text

The property value specified in the Nexacro Platform prioritizes processing the text displayed on the screen. The priorities are as follows.

displaytext > text > titletext > value

Processing the Element Mouse Click Event

The mouse click event occurs at the center of the Element.

C#

element.Click();

Java

element.click();

Comm

POST /session/:sessionId/element/:id/click

Since the mouse click event occurs at the center of the element, the caret position does not move to the front in the case of the MaskEdit component. In this case, you can enter the CTRL+"A" keys to select the entire input area and then enter the text string.

$r_title(C#)

[TestMethod]
public void Test_10_MaskEditInput()
{
	WindowsElement nexaMaskEdit00 = session.FindElementByAccessibilityId("mainframe.ChildFrame00.form.MaskEdit00");
	Assert.IsNotNull(nexaMaskEdit00);
	Thread.Sleep(TimeSpan.FromSeconds(0.1));

	nexaMaskEdit00.Clear();
	nexaMaskEdit00.Click();
	nexaMaskEdit00.SendKeys(Keys.Control + "a");
	Thread.Sleep(TimeSpan.FromSeconds(0.1));
	nexaMaskEdit00.SendKeys("abcde1234"+Keys.Enter);
	Assert.AreEqual("abcde-1234", nexaMaskEdit00.Text);
}

Deleting the Element Input Value

Delete the input value of the component with the text editing area.

C#

element.Clear();

Java

element.clear();

Comm

POST /session/:sessionId/element/:id/clear

Passing the Keyboard Input Value to Element

Process the keyboard input value.

C#

element.SendKeys(KeyString)

Java

element.sendKeys(KeyString)

Comm

POST /session/:sessionId/element/:id/value

Input values are processed differently depending on the component.

Please refer to the "Basic Key Action" item of the component in Product Help.


When passing keyboard input values, the app must be enabled, and if 2 or more windows are displayed, then the target window must be enabled.

The keyboard input value must be passed after processing the mouse click event to the target element to operate normally.

If 2 or more displays are being used, then the keyboard input values may not be passed normally. Either use only one display, or restart the WinAppDriver.

Checking Whether the Element is Selected

Return the Selected status value of the Element.

C#

isSelected = element.Selected;

Java

isSelected = element.isSelected();

Comm

GET /session/:sessionId/element/:id/selected

Components and controls supported in the Nexacro Platform are as follows.

CheckBox, RadioButton, TabButton, ListBoxItem, MenuItem, TreeCell, GridCell

Checking Whether the Element Can be Used

Return the Enabled status value of the Element.

C#

isEnabled = element.Enabled;

Java

isEnabled = element.isEnabled();

Comm

GET /session/:sessionId/element/:id/enabled

Checking Whether the Element Screen is Displayed

Return whether the Element is displayed.

C#

isDisplayed = element.Displayed;

Java

isDisplayed = element.isDisplayed();

Comm

GET /session/:sessionId/element/:id/displayed

It is not returning the visible property value of the component, but rather it is returning whether it is displayed on the actual screen.

element.Displayed

Input Operation

true

visible = true

When all or part of the component is shown in the screen area

false

visible = false

When visible = true, but if the scroll bar of the parent container component is not moved, located in an invisible area on the screen

If the visible property value of the component is set to false when starting the app, then the corresponding Element cannot be found. This is because the Element is created only when the visible property value is true in the Nexacro Platform.

The Element can be processed by setting the visible property value to true when loading the app and then changing the visible property value of the component to false within the onload event function.

Checking the Element Size Information

Return the Element size in the form of the Size object.

C#

size = element.Size;

Java

size = element.getSize();

Comm

GET /session/:sessionId/element/:id/size

Checking the Element Position Information (Based on the Parent Element)

Return the Element position in the form of the Point object based on the parent Element.

C#

size = element.Location;

Java

size = element.getLocation();

Comm

GET /session/:sessionId/element/:id/location

Checking the Element Position Information (Based on the Screen)

Return the Element position in the form of the Point object based on the Screen.

C#

size = element.LocationOnScreenOnceScrolledIntoView;

Java

Not supported

Comm

GET /session/:sessionId/element/:id/location_in_view

Obtaining the Enabled Element

Return the currently enabled Element.

C#

element = session.SwitchTo().ActiveElement();

Java

element = session.switchTo().activeElement();

Comm

GET /session/:sessionId/element/active

Comparing 2 Elements

Compare Elements to see if they are the same Element.

C#

isEqual = element.Equals(element2);

Java

isEqual = element.equals(element2);

Comm

GET /session/:sessionId/element/:id/equals

Checking the UIA Interface Attribute Value of the Element

Provide the attribute value of the UIA Interface of the Element.

C#

element.GetAttribute("AutomationId");

Java

element.getAttribute("AutomationId");

Comm

GET /session/:sessionId/element/:id/attribute/:name

Automation Element Property Identifiers

https://docs.microsoft.com/en-us/windows/desktop/WinAuto/uiauto-automation-element-propids

ScreenShot

Obtaining the Window & Element Screenshot

Return the Screen window area or the Element as a Screenshot object.

C#

Screenshot sessionshot = session.GetScreenshot();

Java

Screenshot sessionshot = session.getScreenshotAs();

Comm

GET /session/:sessionId/screenshot 
GET /session/:sessionId/element/:id/screenshot

You can use the SaveAsFile method, AsBase64EncodedString property, to convert to an image file or to Base64 format.

The window must be exposed at the top to obtain a normal screenshot.

Java code can only access repositories for which you have privileges.

$r_title(Java)

FileHandler.copy(sessionshot, new File(System.getProperty("user.home")+"\\Downloads\\SessionScreenShot.png"));

Related Link Information

WebDriver Interface

http://www.w3.org/TR/webdriver1/
https://www.seleniumhq.org/projects/webdriver/
https://developer.mozilla.org/en-US/docs/Web/WebDriver

AppDriver Interface

https://github.com/Microsoft/WinAppDriver
https://appium.io/docs/en/drivers/windows/
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

UIA Interface

https://docs.microsoft.com/en-us/windows/desktop/WinAuto/entry-uiauto-win32
https://docs.microsoft.com/en-us/windows/desktop/winauto/testing-tools
https://en.wikipedia.org/wiki/Microsoft_UI_Automation

MSAA Interface

https://docs.microsoft.com/en-us/windows/desktop/WinAuto/microsoft-active-accessibility
https://docs.microsoft.com/en-us/windows/desktop/winauto/testing-tools
https://en.wikipedia.org/wiki/Microsoft_Active_Accessibility