HandlingLoadingOrders.java 2.27 KB
package pageObiect.CabinetTask;

import com.essa.framework.BasePage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static jdk.nashorn.internal.objects.Global.print;

import com.essa.framework.BasePage;
import com.essa.framework.LogType;
import com.essa.framework.Logger;


/**
 * Created by Administrator on 2018/10/30 0030.
 */
public class HandlingLoadingOrders extends BasePage {
    public HandlingLoadingOrders(WebDriver driver) {
        super(driver);
    }

    WebDriver webDriver;
    /*
	 * 元素定位
	 */

    //实际装柜日期
    @FindBy(xpath = "//input[@id='loadCompleteDate']")
    WebElement loadCompleteDate;

    //获取装柜商品列表
    //@FindBy(xpath ="//td[@ng-repeat='item in taskInfo.skuList']")
    //WebElement tdList;
    @FindBy(xpath = "//tbody[2]/tr[1]/td[6]")
    WebElement firstTr;//定位第一行

//    //获取元素列表循环读取值
//    public ArrayList<String> getTrtd() {
//        String trs=testtrList.getText();
//
//        WebElement temp;
//        for (int kk=0;kk<0;kk++){
//            temp= driver.findElement(By.xpath("//tbody[2]/tr["+kk+"]/td[6]"));
//            temp.getText();
//
//        }

//       ArrayList arryList = new ArrayList();
//        //arryList.set(0,trs);
//        System.out.print(trs+"123456789---------");
//        return arryList;
//    }

    //输入实装箱数
    @FindBy(xpath = "//input[@id='actLoadBoxQuantity']")
    WebElement realNumber;

    //提交
    @FindBy(xpath = "//*[text()='提交']")
    WebElement submit;

    /**
     * 设置装柜处理参数
     */
    public HandlingLoadingOrders setHandlingCabinet() {
        dynamicLoad(By.xpath("//div[@style='display: none;' and @id='mask']"));
        //设置实际装柜日期
        jsExecutorRemoveAttribute(loadCompleteDate, "readonly");
        loadCompleteDate.click();
        forceWait(500);
        SimpleDateFormat zs=new SimpleDateFormat("MM/dd/yyyy");
        String s =zs.format(new Date());
        sendKeys(loadCompleteDate,s);
        click(submit);
        return new HandlingLoadingOrders(driver);
    }


}