sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #59434
[Question #817669]: Text based Recognition Document
New question #817669 on SikuliX:
https://answers.launchpad.net/sikuli/+question/817669
Hi folks,
I'm trying to use text based recognition in SikuliX. Since, I'm in a state where I can't use image based recognition. I could able to recognize some texts that are in higher font size, known formats like Times New Roman but I couldn't recognize some even though they are in the visible places. Did anyone faced this? And if you share any proper documentation for this text based recognition that would be great.
Here's what I have tried:
String path = "Administrators/Akhil";
String[] pathArray = path.split("/");
for (String value : pathArray) {
System.out.println("Checking value: " + value);
boolean found = false;
int scrollCount = 0;
while (!found && scrollCount < maxScrollAttempts) {
try {
// Find the text within the defined region
org.sikuli.script.Match matchValue = searchRegion.findText(value);
if (matchValue != null) {
matchValue.hover();
matchValue.find(value).offset(-28, 0).hover();
matchValue.click(Mouse.at());
found = true;
System.out.println("Found and clicked on target element: " + value);
} else {
System.err.println("Text not found: " + value);
// Scroll down if not found
screen.wheel(1, 10);
// Small delay
Thread.sleep(1000);
}
// Delay between scroll attempts
Thread.sleep(3000);
} catch (FindFailed e) {
System.err.println("Error finding text: " + value);
e.printStackTrace();
} catch (InterruptedException e) {
System.err.println("Interrupted while waiting: " + e.getMessage());
e.printStackTrace();
}
scrollCount++;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
System.out.println("Execution complete.");
}
Tried directly as images for few, as a single String, and as String Array.
Thanks in advance.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.