sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #31574
Re: [Question #264696]: How to Extract the text from a textfield using SIKULI in java application?
Question #264696 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/264696
Status: Open => Answered
David Scheele proposed the following answer:
In what way "extract"?
If you can get the text highlighted (by clicking on if with sikuli or by tabbing into it it usually gets highlighted) you can just use the following:
type("c", KeyModifiers.CTRL)
to copy the highlighted text and
Env.getClipboard()
to do something with it.
For example:
type(Key.TAB + Key.TAB + Key.TAB) #selects the text field
paste(examplemailvar) #pastes a text into the field
type(Key.TAB + Key.TAB + Key.TAB) #selects the text field again, highlighting the text
type("c", KeyModifier.CTRL) #copies the highlighted text to clipboard
assert (Env.getClipboard() == examplemailvar), "E-Mail was not set" #compares the text to the one set before
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.