FindElementByClassName Method (Mobile Objects)

Applies to TestComplete 14.91, last modified on July 20, 2021

Description

Use the FindElementByClassName method to find a tested mobile object that has the specified class name.

The method returns the first found object that matches the condition. To get all the objects that match the condition, use the FindElementsByClassName object.

Requirements

  • An active license for TestComplete Mobile Module.

  • The Appium Support plugin must be enabled in TestComplete. You can check the plugin state in the File > Install Extensions dialog in TestComplete. You can find the plugin in the Mobile group.

  • Your TestComplete workstation must have access to the mobile device cloud.

  • Your tested mobile application must be compiled with accessibility information. To learn more, see the documentation for the IDE you use to develop your application.

  • A testing session must be opened on your mobile device, and your test must have access to that session. See Connecting to Mobile Device Clouds and Opening Testing Sessions.

Declaration

TestObj.FindElementByClassName(ClassName)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClassName [in]    Required    String    
Result A mobile object or a null object

Applies To

The method is applied to the following object:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameter:

ClassName

A string that specifies the class name of the sought-for object.

Result Value

The method returns an object that matches the specified search criteria.

If no matching object was found, the method returns an empty value (null in JavaScript, JScript, C#Script, and C++Script, None in Python, Nothing in VBScript, nil in DelphiScript) and posts an error message to the test log. Depending on how your project is configured to handle errors, TestComplete may stop the entire test run when the error is posted. To avoid errors, you can use the WaitElement methods instead.

See Also

WaitElementByClassName Method (Mobile Objects)
FindElementsByClassName Method (Mobile Objects)
About Mobile Tests

Highlight search results