Blame view

src/main/java/com/essa/pageObject/GoodsManage/UpdatePicPage.java 1.98 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
  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 UpdatePicPage extends BasePage {
  	public UpdatePicPage(WebDriver driver) {
  		super(driver);
  	}
b2af39f8   zengjin   新增开发商品
19
  //	public static String picPath;
27d9a429   suweicheng   开发梳理;
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
  	
  	/*
  	 * 元素定位
  	 */
  	
  	//检查点
  	@FindBy(xpath="//*[text()='SPU信息']")
  	WebElement checkPoint;
  	
  	//spu上传图片按钮
  	@FindBy(xpath="//*[@id='spuWrapper']/div[3]/div[2]")
  	WebElement spuUploadPic;
  	
  	//spu的主图
  	@FindBy(xpath="//*[@class='load-pic']")
  	WebElement spuPic;
  	
  	//sku上传图片按钮
  	@FindBy(xpath="//*[@id='skuWrapper']/div/div/div[1]/div[2]")
  	WebElement skuUploadPic;
  	
  	//SKU图片上的X
  	@FindBy(xpath="//*[contains(@ng-click,'picInfo,')]")
  	WebElement skuPic;
  	
  	//保存按钮
  	@FindBy(xpath="//*[text()='保存']")
  	WebElement save;
  	
  	//保存成功提示
  	@FindBy(xpath="保存成功")
  	WebElement succeedMessage;
  	
  	/*
  	 * 以下为页面方法
  	 */
  	
  	/**
  	 * 更新商品图片
  	 * @param picPath 作为商品图片的本机地址
  	 * @return GoodsRelesePage
  	 */
  	public GoodsRelesePage upDatePic() {
  		forceWait(2000);
  		dynamicWait(By.xpath("//*[text()='SPU信息']"));
  		click(spuUploadPic);
b2af39f8   zengjin   新增开发商品
66
67
  //		uploadFile(picPath);
  		uploadFile(Model.getPicPath());
27d9a429   suweicheng   开发梳理;
68
69
  		dynamicWait(By.xpath("//*[@class='load-pic']"));
  		click(skuUploadPic);
b2af39f8   zengjin   新增开发商品
70
71
  //		uploadFile(picPath);
  		uploadFile(Model.getPicPath());
27d9a429   suweicheng   开发梳理;
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  		dynamicWait(By.xpath("//*[contains(@ng-click,'picInfo,')]"));
  		forceWait(1000);
  		click(save);
  		return new GoodsRelesePage(driver);
  	}
  	
  	/**
  	 * 断言更新图片是否成功
  	 * @return
  	 */
  	public boolean isSucceed() {
  		return isElementExist(succeedMessage);
  	}
  	
b2af39f8   zengjin   新增开发商品
86
87
88
89
90
91
92
  //	/**
  //	 * 通过GUI设置本机图片路径
  //	 * @param picpath
  //	 */
  //	public static void setPicPath(String picpath) {
  //		picPath = picpath;
  //	}
27d9a429   suweicheng   开发梳理;
93
  }