Selenium 工程引入Sikuli包--处理弹出框
Sikuli 我理解是一个通过截图来识别对象的自动化工具.也可以用来解决现在web碰到的问题,如弹出框,flash等.下面给出一个例子:
1.安装Sikuli
2.把要实现的功能用sikuli录制了一次
3.要Sikuli安装目录下的sikuli-script.jar 引入到selenium工程/**
* 弹出框输入username passwrod
* @throws Exception
*/
public void testTemplate() throws Exception{
Screen s=new Screen();
SikuliScript sc=new SikuliScript();
selenium.windowMaximize();
//选中打开的ff
sc.switchApp("mozilla firefox");
//输入url
s.type(dataPath+"img\\1282553264482.png","http://****/",0);
s.click(dataPath+"img\\1282551664884.png", 0);
//选择弹出框
sc.switchApp("需求验证");
//username
s.type(dataPath+"img\\1282550260954.png", "xiaomia",0);
//password
s.type(dataPath+"img\\1282550283407.png", "aaaa",0);
s.click(dataPath+"img\\1282551863789.png", 0);
Thread.sleep(1000);
//selenium code
selenium.open("/");
}
下次有好东西记得弄个video啊,不要注释也行。顶下!加油,小米!
下次有好东西记得弄个video啊,不要注释也行。这样看起来比较快。顶下!加油,小米! 不错 :dizzy:不是很明白 java.lang.UnsatisfiedLinkError: C:\Documents and Settings\CNNIC\Local Settings\Temp\tmplib\VisionProxy.dll: Can't find dependent librariesat java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1674)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1005)
at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
at org.sikuli.script.Finder.<clinit>(Finder.java:33)
at org.sikuli.script.Region.doFind(Region.java:1029)
at org.sikuli.script.Region$RepeatableFind.run(Region.java:1232)
at org.sikuli.script.Region$Repeatable.repeat(Region.java:1203)
at org.sikuli.script.Region.wait(Region.java:497)
at org.sikuli.script.Region.find(Region.java:381)
at org.sikuli.script.Region.getLocationFromPSRML(Region.java:1129)
at org.sikuli.script.Region.click(Region.java:606)
at frist.TestAlert.testTest(TestAlert.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
楼主,我的报这个错是怎么回事 回复 5# kx_monitor
自己回复,已经解决,是配置的问题
有朋友有问题可以回复我 回复 6# kx_monitor
我也遇到了,之前解决过一次,后来忘记了,请问你是怎么解决的呢? 表示看不明白
页:
[1]