Blame view

src/test/java/com/essa/pageObject/HomePage.java 1.69 KB
fdd4bb76   zengjin55   windows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
  package com.essa.pageObject;  
    
  import org.openqa.selenium.WebDriver;  
  import org.openqa.selenium.WebElement;  
  import org.openqa.selenium.support.FindBy;
  import com.essa.framework.BasePage;  
    
  public class HomePage extends BasePage{  
      public HomePage(WebDriver driver) {  
          super(driver);  
            
      }  
      
      /*
       * 元素定位
       */
      
      //退出
      @FindBy (xpath="//*[text()='退出']")
      WebElement logout;
      
      //供应商管理
      @FindBy (xpath="//*[text()='供应商管理']")
      WebElement supplier;
      
      //平台运营跟进管理
      @FindBy (xpath="//*/a[contains(text(),'平台运营跟进管理')]")
      WebElement operationsTrack;
      
      //供应商查询
      @FindBy (xpath="//*[text()='供应商查询']")
      WebElement searchSuppliers;
      
      /*
       * 方法
       */
      
      //进入运营跟进管理页面
      public SupplierOperationsTrackPage goToSupplierOperationsTrack() {
      	
      	//点击 供应商管理
      	click(supplier);
      	
      	//点击 平台运营跟进管理
      	click(operationsTrack);
      	
      	//此时,系统会加载一个平台运营跟进管理页面,故在此初始化该页面并将driver传递过去
      	return new SupplierOperationsTrackPage(driver);
      	
      }
      
      //判断是否存在退出按钮
      public boolean isSucceed() {
      	
      	//判断退出按钮是否存在,存在则表示成功进入首页
      	return isThisPage("退出", logout);
      	
      }
      
      //判断是否选中“供应商管理”
      public boolean isSearchSuppliers() {
      	
      	return isElementExist(searchSuppliers);
      	
      }
      
      //退出登录
      public void logout() {
      	
      	click(logout);
      	
      }
  }