how to verify special character are present or not

Asked by thomas

Suppose i want to search for hello### how to verify whether "#" is present in search result.I have tried the following but its not working :

I am copying the values(Data) from another file..ok :
Now:

x = type("c", KeyModifier.CTRL)

after opening any search engine :

type("v", KeyModifier.CTRL)
type(Key.ENTER)

if not (x) :
        popup("# is not there")

Question information

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

--- if not (x) :
I do not understand what that should test, since I cannot see what x is

Revision history for this message
thomas (ramitdas2009) said :
#2

I am trying to store the value, that I am copying from another file in the variable x.

x contains hello###
i don't think it will work

Revision history for this message
thomas (ramitdas2009) said :
#3

x = type("c", KeyModifier.CTRL)

after opening any search engine :

x = type("v", KeyModifier.CTRL)
type(Key.ENTER)
wait(20)

if not (x) :
        popup("# is not there")

x is storing the value hello###, this value is dynamic, since I am copying from a different file, where there are various data.
now in the search result screen I want to search whether the entire string "hello###" is present or not.

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

Ok, understood - no will not work ;-)

type("c", KeyModifier.CTRL)
x = Env.getClipboard()
print "from Clipboard:", x # now x should contain, what you have "read" from the file

# after opening any search engine :
# --- how do you do that?
type("v", KeyModifier.CTRL)
type(Key.ENTER)
# now the value should be pasted into the entry field

If you now want to test, wether the value has really been pasted, you have to again get it back to the clipboard
type("a", KeyModifier.CTRL) # select all
type("c", KeyModifier.CTRL)
xPasted = Env.getClipboard()
# now you can compare
if x == xPasted: print "Oh yes it pasted well"
else: print "Something went wrong"

Revision history for this message
thomas (ramitdas2009) said :
#5

seriously dude awesome...
haven't checked it yet but iam sure it will...................

Thanks.........

Revision history for this message
thomas (ramitdas2009) said :
#6

:-(
ctrl+a do not works. So i cant search like that.

Revision history for this message
thomas (ramitdas2009) said :
#7

after search it opens a window which contains various available product it that website. Here ctrl +a do not work. Now, what to do. Help please. Tab is also not working.

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

If I understand right, then you finally have a webpage, that contains search results and now you want to know, wether the entries contain the text you have given before ???

If this is true, either send me a screenshot of the situation (mail see https://launchpad.net/~raimund-hocke) or post it somewhere and add the link here.
and note the text, you are looking for.

Revision history for this message
thomas (ramitdas2009) said :
#9

ok

Revision history for this message
thomas (ramitdas2009) said :
#10

Thanks RaiMan, that solved my question.