sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #34066
[Question #270031]: Strategy to Automate Oracle Forms application
New question #270031 on Sikuli:
https://answers.launchpad.net/sikuli/+question/270031
Hi,
I am very new to Sikuli and I am here to discuss the best strategy to automate Oracle Forms application.
I am looking forward to use Java and sikuli-java.jar to achieve the same.
Please check the link below to understand the UI of the application I am trying to automate.
https://drive.google.com/folderview?id=0B7JZpD97Cnz2fmNQNGMzbmpUWmhsVU5SWDBiSGNuZm1kd1NTMGthaThyLXcxcU5heTVndmc&usp=sharing
This application has got multiple text fields, drop downs, radio buttons, tables and corresponding labels for user interactions.
I have tried and succeeded to automate the same to get an hands on experience with sikuli, but it looks too tedious. I am looking for a simpler and maintainable solution to achieve the same, also I need some option to use like -
if the image exist then do this else do that, some solution to work on tables which has column names, some option for partial image recognition, some strategy to design recovery scenario.
Please check code below and let me know your thoughts to optimize.
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.net.MalformedURLException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Region;
import org.sikuli.script.Screen;
public class TestSikuli {
public static void main(String[] args) throws FindFailed, MalformedURLException, InterruptedException, AWTException{
WebDriver wd;
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability("ignoreZoomSetting", true);
System.setProperty("webdriver.ie.driver", "C:\\AutomationFramework\\externalDrivers\\IEDriverServer.exe");
wd = new InternetExplorerDriver(capabilities);
wd.manage().window().maximize();
wd.get("https://isisdevforms11.retirementpartner.com/forms/frmservlet?config=chooser&otherparams=cm_code=ISIS_DEVL");
Thread.sleep(10000);
Screen scr = new Screen();
Region scrnRgn = scr.find(Globals.pageLogin+"frmLogin.png");
scrnRgn.find(Globals.pageLogin+"txtUserName.png").right(20).click();
ClearTextLogin();
scrnRgn.find(Globals.pageLogin+"txtUserName.png").right(20).type("svkdtt");
scrnRgn.find(Globals.pageLogin+"txtPassword.png").right(20).doubleClick();
scrnRgn.find(Globals.pageLogin+"txtPassword.png").right(20).type("Redcar2982!");
scrnRgn.find(Globals.pageLogin+"btnConnect.png").click();
scrnRgn = scr.wait(Globals.pageHome+"frmSelectDB.png",50000);
scrnRgn.find(Globals.pageHome+"radDevelopment401KDBConnection.png").left(30).click();
scrnRgn.find(Globals.pageHome+"btnNext.png").click();
scrnRgn.find(Globals.pageHome+"radQADevCodeBase.png").left(30).click();
scrnRgn.find(Globals.pageHome+"btnFinish.png").click();
try{
scrnRgn = scr.wait(Globals.pageISIS+"frmISIS.png",5000);
}catch(Exception e){
scr.find(Globals.pageScreen+"iconIE.png").click();
scr.find(Globals.pageScreen+"isisTaskMenu.png").click();
}
scrnRgn.find(Globals.pageISIS+"txtEnterCode.png").right(20).click();
ClearTextForm();
scrnRgn.find(Globals.pageISIS+"txtEnterCode.png").right(20).type("NUCS");
KeyAction("enter");
scr.find(Globals.pageScreen+"iconIE.png").click();
scr.find(Globals.pageScreen+"isisTaskMenu.png").click();
scrnRgn = scr.wait(Globals.pageAddUser+"frmAddUser.png",5000);
KeyAction("f4");
scrnRgn.find(Globals.pageAddUser+"txtUserClass.png").right(50).click();
scrnRgn.find(Globals.pageAddUser+"txtUserClass.png").right(50).type("K_9ARZH");
KeyAction("f5");
}
public static void ClearTextLogin() throws AWTException{
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_M);
robot.keyRelease(KeyEvent.VK_M);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_DELETE);
}
public static void ClearTextForm() throws AWTException{
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_F2);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyRelease(KeyEvent.VK_F2);
}
public static void KeyAction(String action) throws AWTException{
Robot robot = new Robot();
if(action.equalsIgnoreCase("enter")){robot.keyPress(KeyEvent.VK_ENTER);}
if(action.equalsIgnoreCase("control")){robot.keyPress(KeyEvent.VK_CONTROL);}
if(action.equalsIgnoreCase("shift")){robot.keyPress(KeyEvent.VK_SHIFT);}
if(action.equalsIgnoreCase("tab")){robot.keyPress(KeyEvent.VK_TAB);}
if(action.equalsIgnoreCase("alt")){robot.keyPress(KeyEvent.VK_ALT);}
if(action.equalsIgnoreCase("f4")){robot.keyPress(KeyEvent.VK_F4);}
if(action.equalsIgnoreCase("f5")){robot.keyPress(KeyEvent.VK_F5);}
}
}
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.