How to wait for Text field while page loading and type text when field is active.

Asked by monicar on 2018-11-06

Is there any alternative to Thread.sleep in sikuli on page loading

  public static void searchCreateNewDonor(String searchDonorText, Screen screen, Pattern searchDonor, Pattern select_CreateDonor) {

        try {

            Thread.sleep(20000);
            screen.wait(searchDonor, 10);
            screen.type(searchDonor, searchDonorText);
            screen.hover(select_CreateDonor);
            screen.doubleClick(select_CreateDonor);

        } catch (FindFailed findFailed) {
            findFailed.printStackTrace();
        }

    }

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-11-07
Last query:
2018-11-07
Last reply:
2018-11-07
masuo (masuo-ohara) said : #1

I understand that "searchDonor" is an image to identify text box.
If so, you can use exists().

[example as python:]
while not exists("searchDonor.png"):
    sleep(1)
paste("searchDonor.png", searchDonorText)

monicar (monicar) said : #2

Thanks masuo!

Can I have example in java please

On Wed, Nov 7, 2018, 5:16 AM masuo <<email address hidden>
wrote:

> Your question #675972 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/675972
>
> Status: Open => Answered
>
> masuo proposed the following answer:
> I understand that "searchDonor" is an image to identify text box.
> If so, you can use exists().
>
> [example as python:]
> while not exists("searchDonor.png"):
> sleep(1)
> paste("searchDonor.png", searchDonorText)
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/675972/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/675972
>
> You received this question notification because you asked the question.
>

Best RaiMan (raimund-hocke) said : #3

Consult the Java docs

monicar (monicar) said : #4

Thanks RaiMan, that solved my question.