Findtext

Asked by Nitin Chaudhari on 2019-11-26

Hi Team,
Thanks for support.

I am working on file upload function. Am getting file name in xls file(cell value)
Dont have any problem while getting filename from xls in variable.

I would like to find the filename in my application screen. once found the file name; I would lie to click and upload the file.
findText(variable) #variable have the filename
Tried with click ; but at times there are many files. And hence finding,uploading unexpected file.
Am not sure how to implement findtext feature in sikulix.
Sample code will be great help.

Regards,
Nitin Chaudhari

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
5 hours ago
Last reply:
4 hours ago
RaiMan (raimund-hocke) said : #1

you can try the following, if your file names 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

Nitin Chaudhari (cnitin) said : #2

Hi RaiMan,
Thanks..!!
I shall try the line and collectLine().
Regards,
Nitin Chaudhari

Nitin Chaudhari (cnitin) said : #3

Hi RaiMan,
Tested with the collectLines() adding in my script.
Am getting error [lines = win_reg.collectLines() AttributeError: 'str' object has no attribute 'collectLines' ]
tried with collectLinesText() also but geeting same error.

code is as below:
 win_reg = ("1575617970943.png")
    lines = win_reg.collectLines() # getting error here
    for line in lines :
        print line.getText()
        winscrpt = line.getText()
        print winscrpt
Is this function is version limitation? I am using SikuliX1.1.3 currently.
Any suggestion for error above mentioned.

Regards,
Nitin Chaudhari

Nitin Chaudhari (cnitin) said : #4

If collectLines() is available in SikuliX 1.1.4 onwards; please let me know for the alternative of collectLines() in version 1.1.3 .

RaiMan (raimund-hocke) said : #5

collectLines() in version 1.1.3: not available

1.1.4/2.0.x have a completely revised implementation of the text/OCR feature based on Tess4J/Tesseract 4

Can you help with this problem?

Provide an answer of your own, or ask Nitin Chaudhari for more information if necessary.

To post a message you must log in.