Blame view

src/test/java/com/essa/pageObject/inquiryManage/ProductInquiryTaskPage.java 2.99 KB
c98c375e   Administrator   all
1
2
3
4
5
6
7
8
9
10
11
  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;

  

  /**

a62053f7   Administrator   add scene
12
   * @author Administrator 成品询价任务列表

c98c375e   Administrator   all
13
   */

a62053f7   Administrator   add scene
14
15
  public class ProductInquiryTaskPage extends BasePage {

  	public ProductInquiryTaskPage(WebDriver driver) {

c98c375e   Administrator   all
16
17
  		super(driver);

  	}

a62053f7   Administrator   add scene
18
  

c98c375e   Administrator   all
19
20
21
  	/*

  	 * 元素定位

  	 */

a62053f7   Administrator   add scene
22
23
  	// 高级查询

  	@FindBy(xpath = "//*[contains(text(),'高级查询')]")

c98c375e   Administrator   all
24
  	WebElement advancedQuery;

a62053f7   Administrator   add scene
25
26
27
  

  	// 商品编码查询

  	@FindBy(xpath = "//*[text()='商品编码']/../div/input")

c98c375e   Administrator   all
28
  	WebElement skuNoQuery;

a62053f7   Administrator   add scene
29
30
31
32
33
34
35
  

  	// 根据PO查询

  	@FindBy(xpath = "//*[text()='来源单号']/../div[1]/input")

  	WebElement POQuery;

  

  	// 高级查询-查询按钮

  	@FindBy(xpath = "//*[@name='advSearch']/div[12]/button[1]")

c98c375e   Administrator   all
36
  	WebElement search;

a62053f7   Administrator   add scene
37
38
39
  

  	// 列表第一行数据

  	@FindBy(xpath = "//*[@ng-table='tableParams1']/tbody/tr[1]")

c98c375e   Administrator   all
40
  	WebElement firstRow;

a62053f7   Administrator   add scene
41
42
43
  

  	// 询价反馈

  	@FindBy(xpath = "//*[contains(text(),'询价反馈')]")

c98c375e   Administrator   all
44
  	WebElement feedBack;

a62053f7   Administrator   add scene
45
46
47
  

  	// 暂无数据--用于检查是否已经成功

  	@FindBy(xpath = "//*[text()='暂无数据']")

c98c375e   Administrator   all
48
  	WebElement isSucceed;

a62053f7   Administrator   add scene
49
  

c98c375e   Administrator   all
50
51
52
53
54
  	/*

  	 * 页面方法

  	 */

  	/**

  	 * 查出要成品询价的商品,进入成品询价反馈页面

a62053f7   Administrator   add scene
55
  	 * 

c98c375e   Administrator   all
56
57
  	 * @return ProductInquiryFeedback

  	 */

a62053f7   Administrator   add scene
58
  	public ProductInquiryFeedbackPage toFeedback() {

c98c375e   Administrator   all
59
60
61
62
63
64
65
  //		mywait(firstRow);

  		click(advancedQuery);

  		sendKeys(skuNoQuery, Model.getSkuNo());

  		click(search);

  		mywait(firstRow);

  		click(firstRow);

  		click(feedBack);

a62053f7   Administrator   add scene
66
  		return new ProductInquiryFeedbackPage(driver);

c98c375e   Administrator   all
67
  	}

a62053f7   Administrator   add scene
68
  

c98c375e   Administrator   all
69
70
  	/**

  	 * 判断页面是否查询不到该商品

a62053f7   Administrator   add scene
71
  	 * 

c98c375e   Administrator   all
72
73
74
75
76
77
78
79
80
  	 * @return boolean

  	 */

  	public boolean isSucceed() {

  		click(advancedQuery);

  		sendKeys(skuNoQuery, Model.getSkuNo());

  		click(search);

  		forceWait(1000);

  		return isVisibility(By.xpath("//*[text()='暂无数据']"));

  	}

a62053f7   Administrator   add scene
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
114
115
116
117
118
119
120
  

  	/**

  	 * 判断根据po单查询,是否全部询价完成

  	 * 

  	 * @return boolean

  	 */

  	public boolean isPOSucceed() {

  		forceWait(1000);

  		return isVisibility(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]"));

  	}

  

  	/**

  	 * 根据PO单号查询询价

  	 * 

  	 * @return 询价反馈页面

  	 */

  	public ProductInquiryFeedbackPage POtoFeedback() {

  		dynamicWait(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]"));

  		click(advancedQuery);

  		sendKeys(POQuery, Model.getPoNum());

  		click(search);

  		dynamicWait(By.xpath("//*[@id='mask' and @style='display: none;']"));

  //		dynamicWait(By.xpath("//*[@ng-table='tableParams1']/tbody/tr[1]"));

  //		mywait(firstRow);

  //		forceWait(2000);

  		click(firstRow);

  		click(feedBack);

  		return new ProductInquiryFeedbackPage(driver);

  	}

  

  	/**

  	 * 如果列表中还存在待询价的单,循环方法,继续询价

  	 * 

  	 * @return

  	 */

  	public ProductInquiryFeedbackPage POcircle() {

  		click(firstRow);

  		click(feedBack);

  		return new ProductInquiryFeedbackPage(driver);

  	}

c98c375e   Administrator   all
121
  }