Region contains 100 clickable link. How can I will be able to click a link based on Plain text pattern
Region contains 100 clickable link. How can I will be able to click a link based on Plain text pattern.
Region have below links:
sports
news
.
.
.
sports1
news1
.
.
Expectation from Sikulix :
If I pass a variable like "sports1". It should click on the link having caption "sports1".
Region.find() or Region.click() does not able to recognize sports1 link (say Region.
Region Documentation:
Click() can accept image path or just plain text. Here I am using plain text. Am I misinterpreting documentation language. Please suggest.
Thanks in advance RaiMan :)
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Sikuli Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- RaiMan
- Solved:
- 2019-11-28
- Last query:
- 2019-11-28
- Last reply:
- 2019-11-27
RaiMan (raimund-hocke) said : | #1 |
SikuliX version?
send me a screenshot to sikulix-
Anup K (anupk) said : | #2 |
Thanks RaiMan.
Version details:
IDE version 2.0.0
sikulix-2.0.0.jar
sikulixapi-2.0.0
Email has been sent with screen shot subject "Region contains 100 clickable link. How can I will be able to click a link based on Plain text pattern"
Please have a look and let me know in case of more information.
Region.
Anup K (anupk) said : | #3 |
If you got any chance to look into it please provide the approach to fix the issue. Thanks!!
RaiMan (raimund-hocke) said : | #4 |
Tried with 2.0.x:
r = Region(
print(r.text())
m = r.findText("test3")
m.click()
Having your image visible on the screen in the Region r, it works for me.
Anup K (anupk) said : | #5 |
If I am applying html font like below. its not working. But if I delete the a{font....} style its working fine.
Save below snippet as "fontStyle.html":
<!DOCTYPE html>
<html>
<head>
<style>
a {font-family:
</style>
</head>
<body>
<h2>HTML Links</h2>
<p>HTML links are defined with the a tag:</p>
<a href="https:/
<a href="https:/
<a href="https:/
<a href="https:/
<a href="https:/
<a href="https:/
<a href="https:/
<a href="https:/
<a href="https:/
</body>
Anup K (anupk) said : | #6 |
Is there any way to train the font or any other approach. Please help.
|
#7 |
--- alternative approach to findText()
you can try the following, since your links are arranged as some lines in a Region:
reg = someRegion # to be defined somehow
lines = reg.collectLines()
# lines is a list of Match objects, one for each line found
for line in lines:
print line.getText() # here you could check the line content as text
#line.hover() # and click it in case
--- Is there any way to train the font or any other approach.
yes, Tesseract is trainable. You have to create your own *.traineddata file and make it accessible to SikuliX.
For the HowTo you have to dive into Tesseract and its training tools (see Tesseract home page).
More I cannot do for you, since this is far beyond the scope of SikuliX.
Anup K (anupk) said : | #8 |
Thanks RaiMan. I will catch you up for further issue.
its solved my problem and got some way around of it.
Anup K (anupk) said : | #9 |
Thanks RaiMan, that solved my question.