硒IDE柔性monkium整合 [英] flex monkium integration with selenium ide

查看:168
本文介绍了硒IDE柔性monkium整合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Flex自动化新手,有没有整合柔性monkium wtih硒IDE来记录特定的测试案例,我们可以在IDE硒

I am newbie for flex automation , is there any possible way to integrate flex monkium wtih selenium ide to record particular test cases as we can do for any web application in selenium ide

推荐答案

您也可以使用Sikuli闪光自动化,请检查此链接为Flash教程自动化先从基本的 Turtorial

You can also use Sikuli for automation of flash Please check this link for Flash automation Tutorial to start with basic Turtorial

用于Java Sikuli API提供基于图像的GUI自动化功能,以Java程序员。它创建,将积极维护bySikuli实验室。使这个API的努力是很多Sikuli用户直接在他们的Java程序中使用Sikuli脚本的功能,而不是写Jython脚本的愿望的回应。这种新的Java库有一个重新设计的API,包括未提供的原Sikuli脚本几个新的功能,如能力相匹配的颜色,处理事件,并找到几何图案,如矩形按钮。
您也可以从下载这个Eclipse项目:
https://drive.google.com/file/d/0B09BIsDTY_AuYVB4ZjJNM3h0ZlE/view ?USP =共享

Sikuli API for Java provides image-based GUI automation functionalities to Java programmers. It is created and will be actively maintained bySikuli Lab. The effort of making this API is a response to the desire of many Sikuli users to use Sikuli Script's functionalities directly in their Java programs, rather than writing Jython scripts. This new Java library has a re-designed API and includes several new functions that were not available in the original Sikuli Script, such as the abilities to match colors, handle events, and find geometric patterns such as rectangular buttons. You can also download this eclipse project from : https://drive.google.com/file/d/0B09BIsDTY_AuYVB4ZjJNM3h0ZlE/view?usp=sharing

步骤:


  1. 打开Eclipse IDE
        创建一个新项目
        下载硒绑定
        下载Sukuli JAR
        右键单击您的项目
        打开新>类

  1. Open Eclipse IDE Create a new Project Download Selenium Bindings Download Sukuli JAR Right click on you project Open New>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计算器链接在浏览器
http://www.terrence.com/flash/calculator.html

Open Flash Calculator Link in Browser "http://www.terrence.com/flash/calculator.html "

需要采取一些小的图像和操作,比如1.png,2.png
,equal.png和multiply.png等,您可以使用截图工具实用
为此其pre-安装在Win 7或更高

Take small images of required number and operations like 1.png,2.png , equal.png and multiply.png etc. you can use snipping tool utility for this purpose its pre-installed in Win 7 or greater

这样的

现在创建函数,该函数图像的路径字符串,然后单击
这种形象在

Now Create function which takes path of image as string and click on that image

code是:

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");
    }

您最后code将是:

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;
        }
    }


}

这篇关于硒IDE柔性monkium整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆