Created
December 18, 2017 03:00
-
-
Save dineshr93/4855916cc9fa5a9769a0c79a1f68d9f0 to your computer and use it in GitHub Desktop.
UI Automate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.din.own; | |
import java.awt.GridBagConstraints; | |
import java.awt.GridBagLayout; | |
import javax.swing.JLabel; | |
import javax.swing.JOptionPane; | |
import javax.swing.JPanel; | |
import javax.swing.JTextField; | |
import org.sikuli.script.FindFailed; | |
import org.sikuli.script.Key; | |
import org.sikuli.script.Screen; | |
//import com.oracle.xmlns.internal.webservices.jaxws_databinding.ExistingAnnotationsType; | |
public class RadarID { | |
public static void main(String[] args) { | |
Screen screen = new Screen(); | |
try { | |
screen.type("d",Key.WIN); | |
//--------------------------------UI | |
JTextField xField = new JTextField(10); | |
JTextField yField = new JTextField(10); | |
JTextField zField = new JTextField(10); | |
JPanel panel = new JPanel(); | |
panel.setLayout(new GridBagLayout()); | |
GridBagConstraints c = new GridBagConstraints(); | |
//-------------------- | |
c.gridx = 0; | |
c.gridy = 0; | |
panel.add(new JLabel("Project_Name:"), c); | |
c.gridx = 1; | |
c.gridy = 0; | |
panel.add(xField, c); | |
//-------------------- | |
c.gridx = 0; | |
c.gridy = 1; | |
panel.add(new JLabel("Total_Components:"), c); | |
c.gridx = 1; | |
c.gridy = 1; | |
panel.add(yField, c); | |
//-------------------- | |
c.fill = GridBagConstraints.HORIZONTAL; | |
//c.ipady = 20; | |
c.gridx = 0; | |
c.gridy = 2; | |
panel.add(new JLabel("Reviewer_emp_id:"), c); | |
c.gridx = 1; | |
c.gridy = 2; | |
panel.add(zField, c); | |
int result = JOptionPane.showConfirmDialog(null, panel, "Please Enter ", JOptionPane.OK_CANCEL_OPTION); | |
if (result == JOptionPane.OK_OPTION) { | |
System.out.println("x value: " + xField.getText()); | |
System.out.println("y value: " + yField.getText()); | |
String projectID = xField.getText(); | |
String comp = yField.getText(); | |
String empid = zField.getText(); | |
screen.type("d",Key.WIN); | |
//---------------------------------UI | |
//String projectID = JOptionPane.showInputDialog("Enter Protex Project Name"); | |
screen.doubleClick("C:\\img/ess.png"); | |
/* | |
screen.doubleClick("C:\\img/ie01.png"); | |
screen.wait("C:\\img/up.png",1000); | |
screen.click("C:\\img/up.png"); | |
while(screen.exists("C:\\img/ie03.png",0)==null){ | |
screen.click("C:\\img/up.png"); | |
screen.type(Key.SPACE); | |
screen.type(Key.SPACE); | |
screen.exists("C:\\img/ie03.png",0); | |
} | |
screen.click("C:\\img/ie03.png");*/ | |
//optimized | |
screen.wait("C:\\img/din.png",1000); | |
//screen.wait("C:\\img/close.png",1000); | |
screen.type("t",Key.CTRL); | |
screen.paste("http://sgpmis02.apac.bosch.com/LandingPage/Home/CallPostMethod?url=http://sgpvmc0097.apac.bosch.com/radar/login.asp"); | |
screen.type(Key.ENTER); | |
//-------------skip | |
/*screen.wait("C:\\img/ie04.png",1000); | |
while(screen.exists("C:\\img/ie04.png",0)==null){ | |
screen.write(Key.SPACE); | |
screen.exists("C:\\img/ie04.png",0); | |
} | |
screen.click("C:\\img/ie04.png"); | |
screen.wait("C:\\img/ie05.png",800); | |
while(screen.exists("C:\\img/ie05.png",0)==null){ | |
screen.exists("C:\\img/ie05.png",0); | |
} | |
screen.click("C:\\img/ie05.png");*/ | |
//-------------skip | |
screen.wait("C:\\img/ie06.png",1000); | |
screen.click("C:\\img/ie06.png"); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.ENTER); | |
//screen.click("C:\\img/ie07.png"); | |
screen.wait("C:\\img/ie08.png",1000); | |
//screen.click("C:\\img/ie08.png"); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.write("o"); | |
screen.type(Key.ENTER); | |
/*screen.wait("C:\\img/ie09.png",1000); | |
screen.click("C:\\img/ie09.png");*/ | |
screen.type(Key.TAB); | |
screen.type(Key.ENTER); | |
// screen.click("C:\\img/ie10.png"); | |
//optimize FOR - Single Person Review | |
screen.wait("C:\\img/ie11.png",1000); | |
// screen.click("C:\\img/ie11.png"); | |
screen.type(Key.TAB); | |
screen.write("fff"); | |
//screen.type(Key.ENTER); | |
/*screen.wait("C:\\img/ie12.png",1000); | |
screen.click("C:\\img/ie12.png");*/ | |
//optimize | |
//leader | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type("303"); | |
screen.type(Key.DOWN); | |
screen.type(Key.ENTER); | |
/*screen.doubleClick("C:\\img/ie13.png"); | |
screen.doubleClick("C:\\img/ie14.png");*/ | |
//leader | |
// No. of Test Cases | |
screen.click("C:\\img/ie16.png"); | |
screen.write("n"); | |
screen.type(Key.ENTER); | |
//screen.click("C:\\img/ie17.png"); | |
// | |
//checkbox | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.type(Key.SPACE); | |
//screen.click("C:\\img/ie18.png"); | |
// | |
screen.click("C:\\img/ie15.png"); | |
screen.paste("OSS_"+projectID); | |
screen.type(Key.TAB); | |
screen.paste(projectID); | |
screen.type(Key.TAB); | |
screen.paste(comp); | |
screen.click("C:\\img/reviewer.png"); | |
screen.wait("C:\\img/sac.png",1000); | |
screen.type(Key.TAB); | |
screen.type(Key.TAB); | |
screen.paste(empid); | |
screen.click("C:\\img/sac.png"); | |
screen.click("C:\\img/r_ok.png"); | |
} | |
} catch (FindFailed e) { | |
JOptionPane.showMessageDialog (null, e.getMessage(), "Info", JOptionPane.INFORMATION_MESSAGE); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment