Blame view

src/main/java/com/essa/pageObject/inquiryManage/ProductInquiryFeedbackPage.java 3.16 KB
27d9a429   suweicheng   开发梳理;
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  package com.essa.pageObject.inquiryManage;
  
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.support.FindBy;
  
  import com.essa.framework.BasePage;
  import com.essa.framework.Model;
  
  /**
   * @author Administrator 成品询价反馈页
   */
  public class ProductInquiryFeedbackPage extends BasePage {
  	public ProductInquiryFeedbackPage(WebDriver driver) {
  		super(driver);
  	}
  
  	/*
  	 * 元素定位
  	 */
  	// 查询类型
  	@FindBy(xpath = "//*[@ng-change='changeSearchType()']")
  	WebElement searchType;
  
  	// 查询条件输入框
  	@FindBy(xpath = "//*[@placeholder='请输入查询条件']")
  	WebElement searchText;
  
  	// 查询按钮
  	@FindBy(xpath = "//button[@ng-click='getFeedbackDetailBySearchInfo()']")
  	WebElement search;
  
  	// 单箱金额
  	@FindBy(xpath = "//*[contains(text(),'单箱金额')]")
  	WebElement singlePrice;
  
  	// 待反馈任务
  	@FindBy(xpath = "//*[contains(text(),'待反馈任务')]")
  	WebElement waitFeedback;
  
  	// 提交审核
  	@FindBy(xpath = "//*[@ng-click='submitFeedback(1)']")
  	WebElement submit;
  
  	/*
  	 * 页面方法
  	 */
  	/**
  	 * 提交询价任务
  	 * 
  	 * @return ProductInquiryTask
  	 */
  	public ProductInquiryTaskPage submit() {
  		// 根据单箱价格是否为空来判断页面是否加载成功
  		for (int count = 0;"单箱金额:".equals(getText(singlePrice))&& count < 7;count++) {
  			forceWait(1000);
  		}
  		selectElement(searchType, "商品编号");
  		sendKeys(searchText, Model.getSkuNo());
  		// 根据sku编号来判断是否加载出想要的sku信息
  		click(search);
  //		boolean b = isVisibility(By.xpath("//*[contains(text(),'" + Model.getSkuNo() + "')]"));
  //		while (!b) {
  //			forceWait(1000);
  //		}
  		dynamicWait(By.xpath("//*[contains(text(),'" + Model.getSkuNo() + "')]"));
  		click(waitFeedback);
  		// 判断是否加载待反馈视图
  //		boolean b1 = isVisibility(By.xpath("//*[contains(text(),'询价要求完成时间')]"));
  //		while (!b1) {
  //			forceWait(1000);
  //		}
  		dynamicWait(By.xpath("//*[contains(text(),'询价要求完成时间')]"));
  		moveHeightScroll("100");
  		click(submit);
  		return new ProductInquiryTaskPage(driver);
  	}
  
  	/**
  	 * 根据PO单,询价
  	 * @return
  	 */
  	public ProductInquiryTaskPage POsubmit() {
  		// 根据单箱价格是否为空来判断页面是否加载成功
  		for (int count=0;"单箱金额:".equals(getText(singlePrice))&&count<7;count++) {
  			forceWait(1000);
  		}
  		selectElement(searchType, "来源PO单/成品采购单号");
  		sendKeys(searchText, Model.getPoNum());
  		click(search);
  //		while (!(isVisibility(By.xpath("//*[@id='mask' and @style='display: none;']")))) {
  //			forceWait(1000);
  //		}
  		dynamicLoad(By.xpath("//*[@id='mask' and @style='display: none;']"));
  		forceWait(1000);
  		click(waitFeedback);
  		dynamicWait(By.xpath("//*[contains(text(),'询价要求完成时间')]"));
  		moveHeightScroll("100");
  		toSubmit();
  		return new ProductInquiryTaskPage(driver);
  	}
  	
  	/**
  	 * 如果【提交审核】在页面中存在,则一直点击,最多等7
  	 */
  	private void toSubmit() {
  		for (int count =0;isVisibility(By.xpath("//*[@ng-click='submitFeedback(1)']"))&&count<7;count++) {
  			click(submit);
  			forceWait(1000);
  		}
  	}
  }