• 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();
    	}
    }
    
  • 相关阅读:
    matlab2016b -ubuntu 1604 -install- and -trouble -shooting--finally-all is ok!!
    cvpr2017-code-etc
    汇率换算自然语言理解功能JAVA DEMO
    聚焦新相亲时代:女孩在京有五六套房哭着想嫁富2代
    cvpr2017年的所有论文下载
    公司危机、下岗困局、不受重视,程序员该如何面对职场挫折?
    利用CH341A编程器刷新BIOS,恢复BIOS,妈妈再也不用担心BIOS刷坏了
    垃圾人定律和垃圾人生存方式定律
    90后女孩的杀身之祸----悲剧酿成--放弃所有的虚构的故事后,你终会发现,真实平淡的现实才是最美好的。
    仓央嘉措比较著名的诗
  • 原文地址:https://www.cnblogs.com/wujianbo123/p/7667877.html
Copyright © 2020-2023  润新知