sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #05028
[Question #169938]: Java: Focus to browser url field?
New question #169938 on Sikuli:
https://answers.launchpad.net/sikuli/+question/169938
Initially I was capturing the url field of the browser as an image and than clicking on it. This was working fine but it needed to capture images for every browser. Bad idea!!!
Better solution is to type in : press ATD key + D. Now I am trying to do this in java. Here is my code:
import org.sikuli.script.*;
public class T3 {
public static void main(String[] args) {
Screen s = new Screen();
try{
App app = new App("C:\\Users\\rmisra\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe");
app.open();
Thread.sleep(3000);
app.focus();
s.highlight(0);
s.type(Key.ALT + "D"); //dosent work
s.type(null, Key.ALT + "D"); //dosent work
s.type(s, Key.ALT + "D"); //dosent work
s.type("http://abc.com");
}
catch(Exception e){
e.printStackTrace();
}
}
}
I am using the latest sikuli script jar. This does not work. It is not sending focus to browser url field. What am I missing? When I do Alt + D on the open window through the keyboard manually, focus goes to url text field.
I do have a general question though: if I am not trying to click on a specific image what should be used as the first field of type method? How does it know that we need to send the event to the screen when PSRL field is null?
Thanks
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.