Remediating "Element Not Found" with flexCorrect

In writing Appium automation scripts, locating elements relies on the Element Selector like XPath, Accessibility, ID. An app element might have an inconsistent locator among various device models. Due to this inconsistency, the script with locator strategy for one particular device doesn't work across other devices. The most common error encountered is "Cannot Find Element". To overcome this problem, automation testers need to do the laborious task of inspecting element selectors on every device under test and write multiple tailored locators scripts for different devices.

At Kobiton, in our efforts to make apps better everywhere, we’re introducing flexCorrect to alleviate this problem.

 

What is flexCorrect?

flexCorrect helps testers identify app elements not solely by element selector but with the help of our AI engine - NOVA. flexCorrect, by the power of image processing from NOVA, scans and identifies elements across a mobile device screen (from a sample Kobiton test session, namely a baseline session).

Then in the case when the Appium script (using element selector) fails to identify elements on a different device due to selector inconsistency, flexCorrect aids recommending those new elements selection with the reference from memorized baseline session elements.

 

How flexCorrect help testers?

flexCorrect allows testers to remediate the test script on the Kobiton portal, or, generate a report with correct element identifiers and remediate on test scripts later.

flexCorrect acts as a self-healing, fall-back solution for the "Cannot Find Element" error due to variance in Element Selector among mobile devices.

 

How to use flexCorrect?

In essence, flexCorrect is a desired capability for the under-test Appium automation script. flexCorrect needs another Kobiton session, be it Manual or Automation, to be the Baseline session to learn element visuals from it. The test steps of the under-test automation session must be identical to those of the Baseline session. 

Using Kobiton manual session as the Baseline session

- After ending the Manual session, obtain the session ID to use as the Baseline session IDScreen_Shot_2022-03-14_at_5.29.07_PM.png 

- Input the flexCorrect & baselineSessionId desired capability to the under-test automation script, then run the script:

capabilities.setCapability("kobiton:flexCorrect", true);

capabilities.setCapability("kobiton::baselineSessionId",285055);Screen_Shot_2022-03-14_at_5.39.43_PM.png

 

Using Kobiton automation session as the baseline session

- Input the enableScriptless desired capability to the Baseline session script before running it: 

capabilities.setCapability("kobiton:enableScriptless", true);

- After the baseline session completes, repeat the same steps as mentioned in the above section (using Manuals as baseline session):

  • Obtain the session ID to use it as the Baseline session ID
  • Input the flexCorrect & baselineSessionId desired capability to the under-test automation script, then run the script:

    capabilities.setCapability("kobiton:flexCorrect", true);

    capabilities.setCapability("kobiton:baselineSessionId",285055); 

Quick view of how flexCorrect has worked on a scritpless session

Within Session Explorer view of a rerun scriptless session, we can see how many corrections flexCorrect has made by the field Number of Corrections.

 

image__1_.png

 

Users can also copy the "Expected Selector" (the selector specified in the user's script but could not be found) and "AI's corrected Selector" (the new selector corrected by AI, ie. flexCorrect).

image__1___1_.png

Was this article helpful?
0 out of 0 found this helpful