sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #33542
Re: [Question #268929]: Openn Login and check if image exists in Desktop application
Question #268929 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/268929
ouedghiri gave more information on the question:
Hello,
I have found a solution for my problem but I don't know how a fill my login and password in a screenregion.
After many researches in sikuli forum, I find function type but this function does not work with DesktopScreenRegion
My code is :
package com.example.tests;
import java.io.File;
import java.net.MalformedURLException;
import java.awt.event.InputEvent;
import org.sikuli.api.*;
import org.sikuli.api.robot.Mouse;
import org.sikuli.api.robot.desktop.DesktopMouse;
import org.sikuli.api.visual.Canvas;
import org.sikuli.api.visual.DesktopCanvas;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.Screen;
import org.sikuli.script.Pattern;
public class maestro {
public static void main(String[] args) throws MalformedURLException {
ScreenRegion s = new DesktopScreenRegion();
Target tg=new ImageTarget(new File("C:\\TRAVAIL\\bandb\\POB\\maestro.PNG");
Target tg2=new ImageTarget(new File("C:\\TRAVAIL\\bandb\\POB\\login.PNG");
ScreenRegion sr= s.find(tg);
Canvas canvas = new DesktopCanvas();
canvas.addBox(sr);
canvas.addLabel(Relative.to(sr).above(30).getScreenRegion(), "Maestro!");
canvas.display(3);
Mouse mouse=new DesktopMouse();
mouse.click(sr.getCenter());
ScreenRegion s2 = new DesktopScreenRegion();
ScreenRegion sr2= s2.find(tg2);
mouse.click(sr2.getCenter());
try {
s2.type(tg2,"admin");
} catch (FindFailed e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
I got an error in Eclipse with s2.type. How can I write my login and password in a identified Desktop Screen Region.
Thanks
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.