phoenixframework自动化测试平台webUI模块执行js代码示例

package org.phoenix.cases;

import java.util.LinkedList;

import org.phoenix.enums.LocatorType;
import org.phoenix.model.CaseLogBean;
import org.phoenix.model.UnitLogBean;
import org.phoenix.proxy.ActionProxy;

/**
 * js执行器测试
 * @author mengfeiyang
 *
 */
public class TestJsExecutor extends ActionProxy{
	@Override
	public LinkedList<UnitLogBean> run(CaseLogBean caseLogBean) {
		init(caseLogBean);
		phoenix.webAPI().openNewWindowByIE("http://www.baidu.com");
		phoenix.webAPI().executeScript("alert(123);");//在指定页面弹出一个alert
		phoenix.webAPI().sleep(3000);
		phoenix.webAPI().closeWindow();
		
		return getUnitLog();
	}
	
	public static void main(String[] args) {
		TestJsExecutor t = new TestJsExecutor();
		
		LinkedList<UnitLogBean> ll = t.run(new CaseLogBean());
		for(UnitLogBean l : ll){
			System.out.println(l.getContent());
		}
	}

}

执行结果以下:java

相关文章
相关标签/搜索