← Back to team overview

sikuli-driver team mailing list archive

[Question #142707]: [Java] Hang in sikuli app.focus() if the app is already running

 

New question #142707 on Sikuli:
https://answers.launchpad.net/sikuli/+question/142707

For understanding, here is my use case...  I have running Firefox.app via Selenium 2.0/WebDriver (FirefoxDriver really) and there is a javascript confirmation popup that WebDriver is not handling correctly.  So I create a Sikuli Screen object and click the <OK> button with Sikuli.  Works great!  I'm really stoked that I can drop into Sikuli whenever I like from my Java automation framework.

Now here's the issue... I have to call screen.click("ok_button.png") twice to get to the <OK> button since Firefox.app is not the active application when the test automation invokes it.  So a single screen.click("ok_button.png") simply brings Firefox.app into focus.  Then a 2nd screen.click("ok_button.png") is required to click the <OK> button.  So to work around that issue, I created a new App("Firefox.app") and then called app.focus() just before the screen.click("ok_button.png").  Now the test hangs and in the output, the last few lines are:

java.library.tmpdir: /Applications/Sikuli-IDE.app/Contents/Frameworks
Mac OS X utilities loaded.
[log] App.focus Firefox.app(0) #0
[log] openApp: "Firefox.app"

So it seems that a called to app.focus() is causing the hang.  Here is the code that hangs:

    	app = new App("Firefox.app");
    	app.focus();
    	
    	Screen s = new Screen();
	s.click("ok_button.png", 0);

The test runs great when I comment out these 2 lines, but then of course I need to call click twice:


    	// app = new App("Firefox.app");
    	// app.focus();
    	
    	Screen s = new Screen();
	s.click("ok_button.png", 0);
	s.click("ok_button.png", 0);

So I'm not sure what's going on.  Any suggestions?


-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.