Blame view

src/test/java/com/buyer/pageObject/ConslidationPage.java 2.36 KB
c98c375e   Administrator   all
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
  package com.buyer.pageObject;

  

  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 ConslidationPage extends BasePage {

  	public ConslidationPage(WebDriver driver) {

  		super(driver);

  	}

  	/*

  	 * 元素定位

  	 */

  	//关闭提示

  	@FindBy(xpath="//*[@class='close']")

  	WebElement close;

  	

  	//选择散货

  	@FindBy (xpath ="//button[text()='Bulk cargo']")

  	WebElement bulkCargo;

  	

  	//确认

  	@FindBy (xpath="//button[text()='OK']")

  	WebElement ok;

  	

  	//查询输入框

  	@FindBy (xpath="//*[@id='left-search']/div/input")

  	WebElement searchText;

  	

  	//查询按钮

  	@FindBy (xpath="//*[@id='left-search']/div/span")

  	WebElement search;

  	

  	//左边列表第一个复选框

  	@FindBy (xpath="//*[@id='left-product-list']/div[1]/div/div[2]/div/ul/li[1]/input")

  	WebElement leftFirstCheckbox;

  	

  	//中间加入右边的箭头

  	@FindBy (xpath="//*[@id='icon-pi-right-big']")

  	WebElement add;

  	

  	//右边的第一个复选框

  	@FindBy (xpath="//*[@id='right-product-list']/div/div/div[2]/div/ul/li[1]/input")

  	WebElement rightFirstCheckbox;

  	

  	//下一步,设置贴纸

  	@FindBy (xpath="//*[@id='next']")

  	WebElement next;

  	

  	//确认弹框-可能会提示价格不一致

  	@FindBy (xpath ="//a[text()='OK']")

  	WebElement ok2;

  	

  	/**

  	 *  开始拼柜

  	 * @return SettingMarkerPage

  	 */

  	public SettingMarksPage conslidation() {

  		//是否有操作提示弹框

  		if(isVisibility(By.xpath("//*[@class='close']"))) {

  			click(close);

  		}

  		forceWait(1000);

  		//是否有选择货柜

  		if(isVisibility(By.xpath("//button[text()='Bulk cargo']"))) {

  			click(bulkCargo);

  			click(ok);

  			forceWait(1000);

  		}

  		sendKeys(searchText, Model.getSkuNo());

  		click(search);

  		click(leftFirstCheckbox);

  		click(add);

  		//是否有加入到暂存柜

  		while(!(isVisibility(rightFirstCheckbox))) {

  			forceWait(1000);

  		}

  		forceWait(1000);

  		moveHeightScroll("100");

  		forceWait(1000);

  		click(next);

  		//如果提示价格变化,确认弹框

  		if(isVisibility(By.xpath("//a[text()='OK']"))) {

  			click(ok2);

  			forceWait(1000);

  			click(next);

  		}

  		return new SettingMarksPage(driver);

  	}

  }