How to select a text containing a common word

Asked by yashaswi

Hi,

I have a label called Name: and another one called File Name:
I need to type the Name against Name: label

When I'm using find(Name) to select the first Name: to fill the text field, it searches for File Name: and then types the name there which is not what I want.

How do I resolve that?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
TestMechanic
Solved:
Last query:
Last reply:
Revision history for this message
yashaswi (yashaswi-kumar) said :
#1

These are the fields my page contains

Type:
Name:
Management Host:
File Name:

SAVE

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Are you using captured images or text in find:

find("Name:")

or

find("image-of-name.png")

A general solution might be to tab through the fields starting at a definite field.

Revision history for this message
yashaswi (yashaswi-kumar) said :
#3

I'm using find("Image-of-name.png")

I have attached the screenshot for the same

This is what I'm doing

click("ProtectionSc.png")
find("PFRVP.png")
click("PFRVP.png")
type(Key.DOWN)
#type("PFRVP.png", "PFR"+Key.ENTER)
while not exists ("Name.png"):
    type(Key.DOWN)

#find("Name.png")
#find("HlesetName.png")
type("Name.png", "Fileset1"+Key.TAB)
type("Fileset1")
click("ManagementHo.png")
click("Selecttodisc.png")
click("LIN_0RA_PR_7.png")
i=0
while(i < 15):
    type(Key.DOWN)
    i = i+1
find("Save.png")
click("Save.png")

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of
RaiMan
Sent: 17 April 2012 18:11
To: <email address hidden>
Subject: Re: [Question #193923]: How to select a text containing a common
word

Your question #193923 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/193923

    Status: Open => Needs information

RaiMan requested more information:
Are you using captured images or text in find:

find("Name:")

or

find("image-of-name.png")

A general solution might be to tab through the fields starting at a
definite field.

--
To answer this request for more information, you can either reply to
this email or enter your reply at the following page:
https://answers.launchpad.net/sikuli/+question/193923

You received this question notification because you asked the question.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

attachments cannot be posted here.

put it somewhere in the net and post a link (e.g. dropbox) or send it to my mail at https://launchpad.net/~raimund-hocke

Revision history for this message
Roman Podolyan (podolyan-roman) said :
#5

IMHO, to get what you want, you can change search order and restrict search to region(s)

Something like that:
1) Search for "File Name:" (and you may type required text there), store coordinates of "File Name:"
2) Using that coordinates, construct a Region (rectangle) above the "File Name:" label, which should contain "Name:", but exclude "File Name:"
3) Search for the "Name:" in that created Region.

Got the idea?

Not a very beautiful solution, maybe, but I would do it this way.

Revision history for this message
RaiMan (raimund-hocke) said :
#6

@ Roman
exactly, that is how it goes - and it is beautiful ;-)

If you learn to think Sikuli, you will get the right solutions.
Thinking Sikuli means: Think in restricting regions - this gives speed and robustness.

Revision history for this message
Best TestMechanic (ndinev) said :
#7

I have another suggestion. Let say page looks like

-----------------------
        Name:
File Name:
-----------------------
So when selecting the image for just Name include the white space before it - [ Name:]. Then change similarity level to 90%. It will find Name only

I also support idea of selecting first field and using TAB to go to next fields(Unless you need to do something more than just entering data)

Revision history for this message
yashaswi (yashaswi-kumar) said :
#8

Hi dinev,

That worked fine for me
Thank you :)

Revision history for this message
yashaswi (yashaswi-kumar) said :
#9

Thanks dinev, that solved my question.