Silk Mobile

Table of Contents (Homepage)

TextFilter

images/images/os-icons/os_ios_150x150.png

images/images/os-icons/os_android_150x150.png

images/images/os-icons/os_windows_150x150.png

images/images/os-icons/os_blackberry_150x150.png

images/images/os-icons/os_symbian02_150x150.png

images/images/os-icons/os_windows_mobile_150x150.png

Description

Designed command to improve TEXT (OCR) recognition abilities either dynamically or through the repository.

Command will filter the color of the text and will avoid other colors on the background. It will precede the actual command to come into affect.

Parameters

  • Color: Color of text to filter - input is is a string Hexadecimal 32 bits format. For example '0xFFFFFF' will refer to the white color, '0x0' refers to black)

  • Sensitivity: Set the filter sensitivity range from "0" to "100" where "100" is no sensitivity at all, and "0" is complete sensitivity. It is not recommended to give value of above 15.

Usage

When there is a text which is overshadowed by its background color and user wants to use TEXT recognition to perform an action on it.

Example

Scenario: In the screen below, we will see how can we use text filter in order to identify text effectively.

In this example, if we want to validate text “Vibrate when ringing” present on the screen, Using TEXT recognition, then we will use command :

client.isElementFound("TEXT", "Vibrate when ringing",0)

Note: It is much more recommended to use Native recognition using the Non-instrumentation feature.

images/download/attachments/3310608/image147.gif

Because of the dark background color compare to the color of the text, the verification may fail. We can improve it by using textFilter command.

How to get the color of the text

Use the debug tab.

Capture the scene of the reflection from where you want to fetch the text color.

Hover your mouse icon on the color that you want to fetch and perform Right-click->Copy TEXT color to Clipboard. See screenshot above.

images/download/attachments/3310608/image148.gif

In that case, the textFilter command should be:

images/download/attachments/3310608/image149.gif

Now, when we will use TextFilter command in conjunction, Silk Mobile will be able to identify “Vibrate when ringing” text

images/download/attachments/3310608/image150.gif

Code Examples

Java Junit 4
client.textFilter("0x626F75", 15);
if(client.isElementFound("TEXT", "Vibrate when ringing", 0)){
// If statement
}
Selenium
driver.client.textFilter("0x626F75", 15);
if(driver.client.isElementFound("TEXT", "Vibrate when ringing", 0)){
// If statement
}
Python code snippet:
client.textFilter("0x626F75", 15);
if(client.isElementFound("TEXT", "Vibrate when ringing", 0)){
// If statement
}
Python Example
self.client.textFilter("0x626F75", 15)
if(self.client.isElementFound("TEXT", "Vibrate when ringing", 0)):
# If statement
pass
Perl code snippet:
$client->textFilter("0x626F75", 15);
if($client->isElementFound("TEXT", "Vibrate when ringing", 0)){
# If statement
}