• POM思想__多个页面时进行的处理


    一、代码如下

    package www.gui.huohu.pom;
    
    import java.util.concurrent.TimeUnit;
    
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    
    public class GongnengTest {
    	static WebDriver driver= null;
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		GongnengTest g= new GongnengTest();
    		//g.dengluGongneng();
    		g.xuqiutianXinzengGongneng();
    
    	}
    	
    	private void init() {
    		// TODO Auto-generated method stub
    		System.setProperty("webdriver.firefox.bin", "D:\FireFox__37\firefox.exe");
    
    		this.driver = new FirefoxDriver();// 启动火狐浏览器
    
    		this.driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);// 元素等待时间
    		this.driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);// 页面加载时间
    		this.driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);// ajax请求
    		this.driver.manage().window().maximize();
    		// this.driver.get("https://www.baidu.com/");// 在浏览器中打开该网址
    		
    		
    		this.driver.get("http://localhost/Agileone/");
    
    	}
    	private void dengluGongneng() {
    		// TODO Auto-generated method stub
    		this.init();
    		new DengLuPage(this.driver).doLogin("admin", "admin", true);
    		if(this.driver.getPageSource().contains("蜗牛学院")) {
    			System.out.println("登录测试__:成功");
    		} else{
    			System.out.println("登录测试__:失败");
    		}
    	}
    	
    	private void xuqiutianXinzengGongneng() {
    		// TODO Auto-generated method stub
    		this.init();
    		new DengLuPage(this.driver).doLogin("admin", "admin", true);
    		new XuqiutianMokuai(this.driver).doXinzeng();
    
    	}
    
    }
    
    package www.gui.huohu.pom;
    
    import java.util.concurrent.TimeUnit;
    
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.firefox.FirefoxDriver;
    
    public class XuqiutianMokuai {
    	WebDriver driver= null;
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    
    	}
    	
    	
    	
    	public XuqiutianMokuai(WebDriver driver) {
    		// TODO Auto-generated constructor stub
    		this.driver= driver;
    	}
    	
    	private void init() {
    		// TODO Auto-generated method stub
    		System.setProperty("webdriver.firefox.bin", "D:\FireFox__37\firefox.exe");
    
    		this.driver = new FirefoxDriver();// 启动火狐浏览器
    
    		this.driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);// 元素等待时间
    		this.driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);// 页面加载时间
    		this.driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);// ajax请求
    		this.driver.manage().window().maximize();
    		// this.driver.get("https://www.baidu.com/");// 在浏览器中打开该网址
    		
    		
    		this.driver.get("http://localhost/Agileone/");
    
    	}
    	
    	private WebElement getXuqiutianLianjie() {
    		// TODO Auto-generated method stub
    		return this.driver.findElement(By.partialLinkText("需求提案"));
    	}
    
    	private void getBianhaoInputbox() {
    		// TODO Auto-generated method stub
    		
    	}
    	
    	private void getChuangjianzheInputbox() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private void getLeixingSelectbox() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private void getZhongyaoxingSelectbox() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private WebElement getBiaotiInputbox() {
    		// TODO Auto-generated method stub
    		return this.driver.findElement(By.id("headline"));
    	}
    	
    	private WebElement getContentButton() {
    		// TODO Auto-generated method stub
    		return this.driver.findElement(By.className("ke-common-icon"));
    	}
    	
    	private WebElement getContentInputBox() {
    		// TODO Auto-generated method stub
    		return this.driver.findElement(By.className("ke-textarea"));
    	}
    	
    	private void getChulijieguoInputbox() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private WebElement getXinzengButton() {
    		// TODO Auto-generated method stub
    		return this.driver.findElement(By.id("add"));
    
    	}
    	
    	private void getShousuoButton() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private void getChongzhiButton() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private void getBianjiButton() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private void getShanchuButton() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private void getXinjianyonghugushiButton() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private void getBianhaoOnerow() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	private void getBiaotiOnerow() {
    		// TODO Auto-generated method stub
    
    	}
    	
    	public void doXinzeng() {
    		// TODO Auto-generated method stub
    		this.getXuqiutianLianjie().click();
    		this.getBiaotiInputbox().sendKeys("wujianbo");
    		this.getContentButton().click();
    		this.getContentInputBox().sendKeys("wujianbo");
    		this.getXinzengButton().click();
    	}
    }
    
  • 相关阅读:
    附近有什么?8款可以查周边的App
    实体店里充话费要怎么弄
    怎样买手机号?
    手机号是SIM卡的号呢,还是买手机时就带的
    网站SSL证书在线检测
    未来什么行业最赚钱
    陈安之-如何选择最赚钱的行业
    斗鱼宣布获C轮15亿融资 直播行业进入资本时代
    2016年Godaddy最新域名转出教程
    GoDaddy账户间域名转移PUSH以及ACCEPT接受域名过户方法
  • 原文地址:https://www.cnblogs.com/wujianbo123/p/7667877.html
Copyright © 2020-2023  润新知