flex monkium 与 selenium 的集成 ide
flex monkium integration with selenium ide
我是 flex 自动化的新手,是否有任何可能的方法将 flex monkium 与 selenium ide 集成以记录特定的测试用例,就像我们可以在 selenium 中对任何 Web 应用程序所做的那样 ide
您也可以使用 Sikuli 实现 Flash 自动化 请检查此 link Flash 自动化教程,从基础开始 Turtorial
Sikuli API for Java 为 Java 程序员提供基于图像的 GUI 自动化功能。它由 Sikuli Lab 创建并将积极维护。做出这个 API 的努力是为了响应许多 Sikuli 用户希望直接在他们的 Java 程序中使用 Sikuli Script 的功能,而不是编写 Jython 脚本。这个新的 Java 库有一个重新设计的 API 并包括几个在原始 Sikuli 脚本中不可用的新功能,例如匹配颜色、处理事件和查找几何图案的能力,例如矩形按钮。
您还可以从以下位置下载此 eclipse 项目:
https://drive.google.com/file/d/0B09BIsDTY_AuYVB4ZjJNM3h0ZlE/view?usp=sharing
步数:
打开 Eclipse IDE
创建一个新项目
下载硒绑定
下载 Sukuli JAR
右键单击您的项目
打开新>Class
Right click on you project
Open Build Path>Configure Build Path
Open Libraries Tab
Click add External Jars button
Add Following Imports
import java.io.File; import java.util.concurrent.TimeUnit;
import org.junit.After; import org.junit.BeforeClass; import
org.junit.Test; import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.firefox.FirefoxDriver; import
org.sikuli.api.*; import org.sikuli.api.robot.Mouse; import
org.sikuli.api.robot.desktop.DesktopMouse;
Add Selenium and Java Bindings
Paste Following code in Your Class
@BeforeClass
public static void setUp() throws Exception {
wd = new FirefoxDriver();
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@Test
public void TestCase1() throws InterruptedException {
}
@After
public void tearDown() {
wd.quit();
}
public static boolean isAlertPresent(FirefoxDriver wd) {
try {
wd.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
在浏览器中打开 Flash 计算器 Link
“http://www.terrence.com/flash/calculator.html “
拍摄所需数量的小图片和1.png,2.png等操作
, equal.png 和 multiply.png 等你可以使用截图工具实用程序
为此,它已预装在 Win 7 或更高版本中
喜欢这些
现在创建将图像路径作为字符串的函数并单击
在那个图像上
代码是:
public void click_Image(String img)
{
s = new DesktopScreenRegion();
target = new ImageTarget(new File(img));
r = s.find(target);
// Create a mouse object
mouse = new DesktopMouse();
// Use the mouse object to click on the center of the target region
mouse.click(r.getCenter());
}
Now add Following code in your test case first navigate to URL by web driver and then click by images which you created example code is
@Test
public void register() throws InterruptedException {
wd.get("http://www.terrence.com/flash/calculator.html");
click_Image("IMG\1.png");
click_Image("IMG\0.png");
click_Image("IMG\plus.png");
click_Image("IMG\2.png");
click_Image("IMG\equal.png");
}
您的最终代码将是:
import java.io.File;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.api.*;
import org.sikuli.api.robot.Mouse;
import org.sikuli.api.robot.desktop.DesktopMouse;
public class testAutomation {
public static FirefoxDriver wd;
ScreenRegion s;
Target target ;
ScreenRegion r;
// Create a mouse object
Mouse mouse ;
public void click_Image(String img)
{
s = new DesktopScreenRegion();
target = new ImageTarget(new File(img));
r = s.find(target);
// Create a mouse object
mouse = new DesktopMouse();
// Use the mouse object to click on the center of the target region
mouse.click(r.getCenter());
}
@BeforeClass
public static void setUp() throws Exception {
wd = new FirefoxDriver();
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@Test
public void register() throws InterruptedException {
wd.get("http://www.terrence.com/flash/calculator.html");
click_Image("IMG\1.png");
click_Image("IMG\0.png");
click_Image("IMG\plus.png");
click_Image("IMG\2.png");
click_Image("IMG\equal.png");
}
@After
public void tearDown() {
wd.quit();
}
public static boolean isAlertPresent(FirefoxDriver wd) {
try {
wd.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
}
我是 flex 自动化的新手,是否有任何可能的方法将 flex monkium 与 selenium ide 集成以记录特定的测试用例,就像我们可以在 selenium 中对任何 Web 应用程序所做的那样 ide
您也可以使用 Sikuli 实现 Flash 自动化 请检查此 link Flash 自动化教程,从基础开始 Turtorial
Sikuli API for Java 为 Java 程序员提供基于图像的 GUI 自动化功能。它由 Sikuli Lab 创建并将积极维护。做出这个 API 的努力是为了响应许多 Sikuli 用户希望直接在他们的 Java 程序中使用 Sikuli Script 的功能,而不是编写 Jython 脚本。这个新的 Java 库有一个重新设计的 API 并包括几个在原始 Sikuli 脚本中不可用的新功能,例如匹配颜色、处理事件和查找几何图案的能力,例如矩形按钮。 您还可以从以下位置下载此 eclipse 项目: https://drive.google.com/file/d/0B09BIsDTY_AuYVB4ZjJNM3h0ZlE/view?usp=sharing
步数:
打开 Eclipse IDE 创建一个新项目 下载硒绑定 下载 Sukuli JAR 右键单击您的项目 打开新>Class
Right click on you project Open Build Path>Configure Build Path Open Libraries Tab Click add External Jars button Add Following Imports import java.io.File; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.BeforeClass; import org.junit.Test; import org.openqa.selenium.NoAlertPresentException; import org.openqa.selenium.firefox.FirefoxDriver; import org.sikuli.api.*; import org.sikuli.api.robot.Mouse; import org.sikuli.api.robot.desktop.DesktopMouse; Add Selenium and Java Bindings Paste Following code in Your Class @BeforeClass public static void setUp() throws Exception { wd = new FirefoxDriver(); wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@Test public void TestCase1() throws InterruptedException { } @After public void tearDown() { wd.quit(); } public static boolean isAlertPresent(FirefoxDriver wd) { try { wd.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; }
}
在浏览器中打开 Flash 计算器 Link “http://www.terrence.com/flash/calculator.html “
拍摄所需数量的小图片和1.png,2.png等操作 , equal.png 和 multiply.png 等你可以使用截图工具实用程序 为此,它已预装在 Win 7 或更高版本中
喜欢这些
现在创建将图像路径作为字符串的函数并单击 在那个图像上
代码是:
public void click_Image(String img)
{
s = new DesktopScreenRegion();
target = new ImageTarget(new File(img));
r = s.find(target);
// Create a mouse object
mouse = new DesktopMouse();
// Use the mouse object to click on the center of the target region
mouse.click(r.getCenter());
}
Now add Following code in your test case first navigate to URL by web driver and then click by images which you created example code is
@Test
public void register() throws InterruptedException {
wd.get("http://www.terrence.com/flash/calculator.html");
click_Image("IMG\1.png");
click_Image("IMG\0.png");
click_Image("IMG\plus.png");
click_Image("IMG\2.png");
click_Image("IMG\equal.png");
}
您的最终代码将是:
import java.io.File;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.api.*;
import org.sikuli.api.robot.Mouse;
import org.sikuli.api.robot.desktop.DesktopMouse;
public class testAutomation {
public static FirefoxDriver wd;
ScreenRegion s;
Target target ;
ScreenRegion r;
// Create a mouse object
Mouse mouse ;
public void click_Image(String img)
{
s = new DesktopScreenRegion();
target = new ImageTarget(new File(img));
r = s.find(target);
// Create a mouse object
mouse = new DesktopMouse();
// Use the mouse object to click on the center of the target region
mouse.click(r.getCenter());
}
@BeforeClass
public static void setUp() throws Exception {
wd = new FirefoxDriver();
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@Test
public void register() throws InterruptedException {
wd.get("http://www.terrence.com/flash/calculator.html");
click_Image("IMG\1.png");
click_Image("IMG\0.png");
click_Image("IMG\plus.png");
click_Image("IMG\2.png");
click_Image("IMG\equal.png");
}
@After
public void tearDown() {
wd.quit();
}
public static boolean isAlertPresent(FirefoxDriver wd) {
try {
wd.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
}