Blame view

src/main/java/com/essa/pageObject/StorageManage/LoadContainerHandlePage.java 1.93 KB
0e4d02cb   toby5221   增加装柜任务形成现存尾货
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
  package com.essa.pageObject.StorageManage;
  
  import com.essa.framework.BasePage;
  import com.essa.framework.Model;
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.support.FindBy;
  
  import java.util.Date;
  
  
  /**
   * 装柜任务处理
   */
  public class LoadContainerHandlePage extends BasePage {
  
      public LoadContainerHandlePage(WebDriver driver){
          super(driver);
      }
  
      /**
       * 元素定位
       */
      // 实装柜日期
      @FindBy (xpath = "//input[@id='loadCompleteDate']")
      WebElement actLoadTime;
  
      // 可装柜箱数
      @FindBy (xpath = "//tr[@class='ng-scope']//td[6]")
      WebElement mayLoadQuantity;
  
      // 实装箱数
      @FindBy (xpath = "//input[@id='actLoadBoxQuantity']")
      WebElement actLoadQuantity;
  
      // 点击选择文件
      @FindBy (xpath ="//div[@id='rt_rt_1cqvbp0jn14kfb41keb187l1u8oh']//label" )
      WebElement actPicture;
  
      // 提交
      @FindBy (xpath = "//*[text()='提交']")
      WebElement submit;
  
      /**
       * 页面方法
       */
      public LoadContainerHandlePage loadTaskHandle(){
          jsExecutorRemoveAttribute(actLoadTime,"readonly");
          String date = getDateTimeByFormat(new Date(), "MM/dd/yyyy");
          sendKeys(actLoadTime,date);
          // 获取‘可装柜数量’字符串中的数量
          String qua = partiaStr(mayLoadQuantity,0,1);
          // 对切片结果进行int转换
          int i = Integer.valueOf(qua).intValue();
          // 形成现存尾货‘2’
          int j = i-2;
          // 对计算结果转换成string,并赋值给“实装柜数量”
          String quantity = String.valueOf(j);
          sendKeys(actLoadQuantity,quantity);
          forceWait(1000);
          // 上传装柜图片
          click(actPicture);
          uploadFile(Model.getPicPath());
          forceWait(1000);
          click(submit);
          forceWait(2000);
          return new LoadContainerHandlePage(driver);
      }
  }