Blame view

src/main/java/com/essa/pageObject/GoodsManage/GoodsRelesePage.java 2.87 KB
27d9a429   suweicheng   开发梳理;
1
2
  package com.essa.pageObject.GoodsManage;
  
b2af39f8   zengjin   新增开发商品
3
  import com.essa.framework.Model;
27d9a429   suweicheng   开发梳理;
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
  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;
  
  /**
   * @author Administrator
   *商品发布管理
   */
  public class GoodsRelesePage extends BasePage {
  	public GoodsRelesePage(WebDriver driver) {
  		super(driver);
  	}
  	/*
  	 * 元素定位
  	 */
  	
  	//商品发布--检查点
  	@FindBy(xpath="//*[text()='商品发布']")
  	WebElement checkPoint;
  	
  	/*
  	//勾选第1个复选框--后续最好根据商品名称来定位勾选框
  	@FindBy(xpath="//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input")
  	WebElement checkBox;
  	*/
  	
  	/**
  	 * 根据商品名称获得其复选框
  	 * @return
  	 */
  	private WebElement getCheckBox() {
  		String no = AddOriginalGoodsPage.getSkuNameNo();
  		return driver.findElement(By.xpath("//*[contains(text(),'"+no+"')]/../../td[1]/input"));
  	}
b2af39f8   zengjin   新增开发商品
41
42
43
44
45
46
47
48
49
  
  	@FindBy (xpath = "//*[@ng-model='query.keyword']")
  	WebElement keyword;//关键字
  
  	@FindBy (xpath = "//*[@ng-click='search()']")
  	WebElement search;//查询按钮
  
  	@FindBy (xpath = "//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input")
  	WebElement checkbox;//第一个复选框
27d9a429   suweicheng   开发梳理;
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
  	
  	//图片更新
  	@FindBy(xpath="//*[contains(text(),'图片更新')]")
  	WebElement updatePic;
  	
  	//编辑
  	@FindBy(xpath="//*[contains(text(),'编辑')]")
  	WebElement edit;
  	
  	/*
  	 * 页面方法
  	 */
  	
  	/**
  	 * 进入更新图片页面
  	 * @return UpdatePicPage
  	 */
  	public UpdatePicPage toUpDatePic() {
  		forceWait(2000);
  		dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input"));
  		click(getCheckBox());
  		click(updatePic);
  		return new UpdatePicPage(driver);
  	}
  	
  	/**
  	 * 进入编辑页面
  	 * @return EditSpuPage
  	 * @throws InterruptedException 
  	 */
  	public EditSpuPage toEditSpuPage() {
  		isThisPage("商品发布", checkPoint);
  		click(getCheckBox());
  		click(edit);
  		return new EditSpuPage(driver);
  	}
b2af39f8   zengjin   新增开发商品
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  
  	/**
  	 *开发商品更新图片
  	 * @param
  	 * @return 更新图片详情页
  	 */
  	public UpdatePicPage toUpdateDevGoodPic(){
  		forceWait(2000);
  		dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input"));
  		sendKeys(keyword,Model.getSkuNo());
  		click(search);
  		forceWait(1500);
  		click(checkbox);
  		click(updatePic);
  		return new UpdatePicPage(driver);
  	}
27d9a429   suweicheng   开发梳理;
102
103
104
105
106
107
108
109
110
111
112
113
114
  	
  	/**
  	 * 断言商品建档是否成功
  	 * @return boolean
  	 */
  	public boolean isAddOrignalSucceed() {
  		forceWait(1000);
  		dynamicWait(By.xpath("//*[@ng-table='preUploadCtrlTableParams']/tbody[1]/tr[1]/td[1]/input"));
  		String SkuNameNo = AddOriginalGoodsPage.getSkuNameNo();
  		//由于@findby只能输入常量,不能输入变量,所以这里用最底层的方法来寻找元素
  		return isVisibility((driver.findElement(By.xpath("//*[contains(text(),'"+SkuNameNo+"')]"))));
  	}
  }