selenium案例一
上一篇 / 下一篇 2016-12-21 13:32:13 / 个人分类:Selenium
package com.quark.apply;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import com.quark.util.IdCardGenerator;
import com.quark.util.StringRandom;
import com.quark.util.NumRandom;
import com.quark.util.UploadFile;
import com.quark.util.StringRandom;
import com.quark.util.NumRandom;
import com.quark.util.UploadFile;
public class AddShangYiDai6 {
public static void main(String[] args) throws InterruptedException, IOException {
ChromeDriverService server = new ChromeDriverService.Builder().build();
server.start();
ChromeOptions ptions = new ChromeOptions();
options.addArguments("start-maximized");
// DesiredCapabilities dc = DesiredCapabilities.chrome();
// dc.setCapability(ChromeOptions.CAPABILITY, options);
// String cli = "http://" + args[0] + ":4444/wd/hub";
// WebDriver brws = new RemoteWebDriver(new URL(cli),dc);
WebDriver brws = new ChromeDriver(options);
brws.manage().timeouts().setScriptTimeout(120,TimeUnit.SECONDS);
brws.manage().timeouts().pageLoadTimeout(120,TimeUnit.SECONDS);
brws.manage().timeouts().implicitlyWait(120,TimeUnit.SECONDS);
//打开申请系统
String url = "http://" + args[0] + "/ProductApplication/Application";
brws.get(url);
brws.findElement(By.id("Account")).sendKeys(args[1]);
brws.findElement(By.id("Pwd")).sendKeys(args[2]);
brws.findElement(By.id("Log_Submit")).click();
//基本资料------------------------------------------------------------------
//客户名称
String custName = args[4] + StringRandom.getRandomString(3);
brws.findElement(By.id("customerName")).sendKeys(custName);
//身份证号码
String idCard = (new IdCardGenerator()).generate();
brws.findElement(By.id("customerIDCard")).sendKeys(idCard);
//选择武汉
WebElement cityInput = brws.findElement(By.id("applyCity"));
new Select(cityInput).selectByVisibleText("长沙");
//选择汉阳营业部
WebElement yingYeBuInput = brws.findElement(By.id("departName"));
new Select(yingYeBuInput).selectByVisibleText("长沙分中心");
//选择职场
WebElement zhiChangInput = brws.findElement(By.id("divisionName"));
new Select(zhiChangInput).selectByVisibleText("长沙");
//业务品种
WebElement yeWuPingZhongInput = brws.findElement(By.id("productCode"));
new Select(yeWuPingZhongInput).selectByVisibleText("商易贷-6.0-" + args[3] + "期");
//还款方式
WebElement huanKuanFangShiInput = brws.findElement(By.id("repaymentType"));
new Select(huanKuanFangShiInput).selectByVisibleText("等额本息还款");
//合作渠道
WebElement heZuoQuDaoInput = brws.findElement(By.id("platform"));
new Select(heZuoQuDaoInput).selectByVisibleText("000000000 **进件");
//借款用途选择经营周转
brws.findElement(By.id("LoanPurposeBusiness")).click();
//申请金额
brws.findElement(By.id("applyAmount")).sendKeys("60000");
//点击下一步
brws.findElement(By.id("submitBtn")).click();
System.out.println("创建进件成功,客户名称:"+custName);
ChromeDriverService server = new ChromeDriverService.Builder().build();
server.start();
ChromeOptions ptions = new ChromeOptions();
options.addArguments("start-maximized");
// DesiredCapabilities dc = DesiredCapabilities.chrome();
// dc.setCapability(ChromeOptions.CAPABILITY, options);
// String cli = "http://" + args[0] + ":4444/wd/hub";
// WebDriver brws = new RemoteWebDriver(new URL(cli),dc);
WebDriver brws = new ChromeDriver(options);
brws.manage().timeouts().setScriptTimeout(120,TimeUnit.SECONDS);
brws.manage().timeouts().pageLoadTimeout(120,TimeUnit.SECONDS);
brws.manage().timeouts().implicitlyWait(120,TimeUnit.SECONDS);
//打开申请系统
String url = "http://" + args[0] + "/ProductApplication/Application";
brws.get(url);
brws.findElement(By.id("Account")).sendKeys(args[1]);
brws.findElement(By.id("Pwd")).sendKeys(args[2]);
brws.findElement(By.id("Log_Submit")).click();
//基本资料------------------------------------------------------------------
//客户名称
String custName = args[4] + StringRandom.getRandomString(3);
brws.findElement(By.id("customerName")).sendKeys(custName);
//身份证号码
String idCard = (new IdCardGenerator()).generate();
brws.findElement(By.id("customerIDCard")).sendKeys(idCard);
//选择武汉
WebElement cityInput = brws.findElement(By.id("applyCity"));
new Select(cityInput).selectByVisibleText("长沙");
//选择汉阳营业部
WebElement yingYeBuInput = brws.findElement(By.id("departName"));
new Select(yingYeBuInput).selectByVisibleText("长沙分中心");
//选择职场
WebElement zhiChangInput = brws.findElement(By.id("divisionName"));
new Select(zhiChangInput).selectByVisibleText("长沙");
//业务品种
WebElement yeWuPingZhongInput = brws.findElement(By.id("productCode"));
new Select(yeWuPingZhongInput).selectByVisibleText("商易贷-6.0-" + args[3] + "期");
//还款方式
WebElement huanKuanFangShiInput = brws.findElement(By.id("repaymentType"));
new Select(huanKuanFangShiInput).selectByVisibleText("等额本息还款");
//合作渠道
WebElement heZuoQuDaoInput = brws.findElement(By.id("platform"));
new Select(heZuoQuDaoInput).selectByVisibleText("000000000 **进件");
//借款用途选择经营周转
brws.findElement(By.id("LoanPurposeBusiness")).click();
//申请金额
brws.findElement(By.id("applyAmount")).sendKeys("60000");
//点击下一步
brws.findElement(By.id("submitBtn")).click();
System.out.println("创建进件成功,客户名称:"+custName);
//填写联系人资料----------------------------------------------------------------
//婚姻状态
WebElement hunYinInput = brws.findElement(By.id("MarrageStatus"));
new Select(hunYinInput).selectByVisibleText("已婚");
//教育程度
WebElement xueLiInput = brws.findElement(By.id("Education"));
new Select(xueLiInput).selectByVisibleText("本科");
//本市房产情况
WebElement fangChanInput = brws.findElement(By.id("HasLocalHouse"));
new Select(fangChanInput).selectByVisibleText("无按揭");
//居住情况
WebElement juZhuInput = brws.findElement(By.id("ResidentStatus"));
new Select(juZhuInput).selectByVisibleText("自有房产");
//现居住省
WebElement juZhuShengInput = brws.findElement(By.id("Resident_Province"));
new Select(juZhuShengInput).selectByVisibleText("湖南省");
//现居住市
WebElement juZhuShiInput = brws.findElement(By.id("Resident_City"));
new Select(juZhuShiInput).selectByVisibleText("长沙市");
//现居住详细地址
String juZhuDetailStr = StringRandom.getRandomString(13);
brws.findElement(By.id("Resident_Detail")).sendKeys(juZhuDetailStr);
//邮编
brws.findElement(By.id("PostCode")).sendKeys("430000");
//在此城市居住年限
brws.findElement(By.id("InLocalYear")).sendKeys("7");
//手机号码
String mobileNum = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("Mobile1")).sendKeys(mobileNum);
//户籍地址省
WebElement huJiShengInput = brws.findElement(By.id("Register_Province"));
new Select(huJiShengInput).selectByVisibleText("湖南省");
//户籍地址市
WebElement huJiShiInput = brws.findElement(By.id("Register_City"));
new Select(huJiShiInput).selectByVisibleText("长沙市");
//户籍地址详细地址
String huJiDetailStr = StringRandom.getRandomString(13);
brws.findElement(By.id("Register_Detail")).sendKeys(huJiDetailStr);
//信用卡最高额度
brws.findElement(By.id("MAX_CREDITLIMIT_OF_CCC")).sendKeys("1");
//本人持有卡的数量
brws.findElement(By.id("NUMS_OF_CCC")).sendKeys("1");
//邮箱
String mailUrl = StringRandom.getRandomString(6) + "@163.com";
brws.findElement(By.id("EMAIL")).sendKeys("test@quarkfinance.com");
//婚姻状态
WebElement hunYinInput = brws.findElement(By.id("MarrageStatus"));
new Select(hunYinInput).selectByVisibleText("已婚");
//教育程度
WebElement xueLiInput = brws.findElement(By.id("Education"));
new Select(xueLiInput).selectByVisibleText("本科");
//本市房产情况
WebElement fangChanInput = brws.findElement(By.id("HasLocalHouse"));
new Select(fangChanInput).selectByVisibleText("无按揭");
//居住情况
WebElement juZhuInput = brws.findElement(By.id("ResidentStatus"));
new Select(juZhuInput).selectByVisibleText("自有房产");
//现居住省
WebElement juZhuShengInput = brws.findElement(By.id("Resident_Province"));
new Select(juZhuShengInput).selectByVisibleText("湖南省");
//现居住市
WebElement juZhuShiInput = brws.findElement(By.id("Resident_City"));
new Select(juZhuShiInput).selectByVisibleText("长沙市");
//现居住详细地址
String juZhuDetailStr = StringRandom.getRandomString(13);
brws.findElement(By.id("Resident_Detail")).sendKeys(juZhuDetailStr);
//邮编
brws.findElement(By.id("PostCode")).sendKeys("430000");
//在此城市居住年限
brws.findElement(By.id("InLocalYear")).sendKeys("7");
//手机号码
String mobileNum = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("Mobile1")).sendKeys(mobileNum);
//户籍地址省
WebElement huJiShengInput = brws.findElement(By.id("Register_Province"));
new Select(huJiShengInput).selectByVisibleText("湖南省");
//户籍地址市
WebElement huJiShiInput = brws.findElement(By.id("Register_City"));
new Select(huJiShiInput).selectByVisibleText("长沙市");
//户籍地址详细地址
String huJiDetailStr = StringRandom.getRandomString(13);
brws.findElement(By.id("Register_Detail")).sendKeys(huJiDetailStr);
//信用卡最高额度
brws.findElement(By.id("MAX_CREDITLIMIT_OF_CCC")).sendKeys("1");
//本人持有卡的数量
brws.findElement(By.id("NUMS_OF_CCC")).sendKeys("1");
//邮箱
String mailUrl = StringRandom.getRandomString(6) + "@163.com";
brws.findElement(By.id("EMAIL")).sendKeys("test@quarkfinance.com");
//客户身份
WebElement shenFen = brws.findElement(By.id("STATION2_COM"));
new Select(shenFen).selectByVisibleText("法人");
//公司固定电话
String comNum = "0731" + NumRandom.getRandomString(8);
brws.findElement(By.id("COM_TEL_NO")).sendKeys(comNum);
//公司名称
String comName = StringRandom.getRandomString(13);
brws.findElement(By.id("COM_NAME")).sendKeys(comName);
//公司地址省
WebElement BusinessPro = brws.findElement(By.id("Business_Province"));
new Select(BusinessPro).selectByVisibleText("湖南省");
//公司地址市
WebElement BusinessCity = brws.findElement(By.id("Business_City"));
new Select(BusinessCity).selectByVisibleText("长沙市");
//公司地址详细
String BusinessDet = StringRandom.getRandomString(10);
brws.findElement(By.id("Business_Detail")).sendKeys(BusinessDet);
//企业注册时间
((JavascriptExecutor)brws).executeScript
("document.getElementById('DATE_COM_REGISTER').removeAttribute('readonly');") ;
brws.findElement(By.id("DATE_COM_REGISTER")).sendKeys("2010/08/08");
//注册资本
brws.findElement(By.id("COM_REGISTER_CAPITAL_AMT")).sendKeys("300");
//企业员工人数
brws.findElement(By.id("COM_PERSONS")).sendKeys("20");
//企业性质
WebElement comProper = brws.findElement(By.id("COM_PROPERTY"));
new Select(comProper).selectByVisibleText("企业法人");
WebElement shenFen = brws.findElement(By.id("STATION2_COM"));
new Select(shenFen).selectByVisibleText("法人");
//公司固定电话
String comNum = "0731" + NumRandom.getRandomString(8);
brws.findElement(By.id("COM_TEL_NO")).sendKeys(comNum);
//公司名称
String comName = StringRandom.getRandomString(13);
brws.findElement(By.id("COM_NAME")).sendKeys(comName);
//公司地址省
WebElement BusinessPro = brws.findElement(By.id("Business_Province"));
new Select(BusinessPro).selectByVisibleText("湖南省");
//公司地址市
WebElement BusinessCity = brws.findElement(By.id("Business_City"));
new Select(BusinessCity).selectByVisibleText("长沙市");
//公司地址详细
String BusinessDet = StringRandom.getRandomString(10);
brws.findElement(By.id("Business_Detail")).sendKeys(BusinessDet);
//企业注册时间
((JavascriptExecutor)brws).executeScript
("document.getElementById('DATE_COM_REGISTER').removeAttribute('readonly');") ;
brws.findElement(By.id("DATE_COM_REGISTER")).sendKeys("2010/08/08");
//注册资本
brws.findElement(By.id("COM_REGISTER_CAPITAL_AMT")).sendKeys("300");
//企业员工人数
brws.findElement(By.id("COM_PERSONS")).sendKeys("20");
//企业性质
WebElement comProper = brws.findElement(By.id("COM_PROPERTY"));
new Select(comProper).selectByVisibleText("企业法人");
//个人年度总收入
brws.findElement(By.id("INCOME_ANNUAL")).sendKeys("30");
//每月工作收入
brws.findElement(By.id("INCOME_MONTHLY_FROM_JOB")).sendKeys("20000");
//每月其他收入
brws.findElement(By.id("INCOME_MONTHLY_FROM_OTHER")).sendKeys("5000");
//目前需要供养人数
brws.findElement(By.id("NUMS_OF_PROVIDE")).sendKeys("0");
//点击下一步
brws.findElement(By.xpath("//button[@data-last='提交申请']")).click();
//联系人资料-----------------------------------------------------------------------------
//姓名
String peiOuNameStr = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_RELATIVE1-APP_CONTACT_NAME")).sendKeys(peiOuNameStr);
//电话
String mobileNum1 = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_RELATIVE1-APP_CONTACT_MOBILE")).sendKeys(mobileNum1);
//工作单位名称
String comName1 = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_RELATIVE1-APP_CONTACT_COM_NAME")).sendKeys(comName1);
//工作单位地址省
WebElement prov1Input = brws.findElement(By.id("CONTACT_RELATIVE1-Com_Province"));
new Select(prov1Input).selectByVisibleText("湖南省");
//工作单位地址市
WebElement city1Input = brws.findElement(By.id("CONTACT_RELATIVE1-Com_City"));
new Select(city1Input).selectByVisibleText("长沙市");
//工作单位详细地址
String comAddr1 = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_RELATIVE1-Com_Detail")).sendKeys(comAddr1);
//子女
WebElement ziNvInput = brws.findElement(By.id("CONTACT_RELATIVE2-RELATIONSHIP"));
new Select(ziNvInput).selectByVisibleText("子女");
//姓名
String ziNvName = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_RELATIVE2-APP_CONTACT_NAME")).sendKeys(ziNvName);
//手机号码
String mobileNum2 = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_RELATIVE2-APP_CONTACT_MOBILE")).sendKeys(mobileNum2);
//工作单位名称
String comName2 = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_RELATIVE2-APP_CONTACT_COM_NAME")).sendKeys(comName2);
//工作单位地址省
WebElement prov2Input = brws.findElement(By.id("CONTACT_RELATIVE2_Com_Province"));
new Select(prov2Input).selectByVisibleText("湖南省");
//工作单位地址市
WebElement city2Input = brws.findElement(By.id("CONTACT_RELATIVE2_Com_City"));
new Select(city2Input).selectByVisibleText("长沙市");
//工作单位详细地址
String comAddr2 = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_RELATIVE2_Com_Detail")).sendKeys(comAddr2);
//同事
WebElement colleageInput = brws.findElement(By.id("CONTACT_JOB_CERT-RELATIONSHIP"));
new Select(colleageInput).selectByVisibleText("同事");
//同事姓名
String colleageName = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_JOB_CERT-APP_CONTACT_NAME")).sendKeys(colleageName);
//手机号码
String colleageMob = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_JOB_CERT-APP_CONTACT_MOBILE")).sendKeys(colleageMob);
//部门
String colleageDepart = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_JOB_CERT-COM_DEPT")).sendKeys(colleageDepart);
//职位
String positDepart = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_JOB_CERT-COM_POSITION")).sendKeys(positDepart);
//朋友
WebElement friendInput = brws.findElement(By.id("CONTACT_OTHER-RELATIONSHIP"));
new Select(friendInput).selectByVisibleText("朋友");
//朋友姓名
String friendName = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_OTHER-APP_CONTACT_NAME")).sendKeys(friendName);
//手机号码
String friendMob = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_OTHER-APP_CONTACT_MOBILE")).sendKeys(friendMob);
//工作单位名称
String friendCom = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_OTHER-APP_CONTACT_COM_NAME")).sendKeys(friendCom);
//工作单位地址省
WebElement friendAddrProInput = brws.findElement(By.id("CONTACT_OTHER-COM_Province"));
new Select(friendAddrProInput).selectByVisibleText("湖南省");
//工作单位地址市
WebElement friendAddrCityInput = brws.findElement(By.id("CONTACT_OTHER-COM_City"));
new Select(friendAddrCityInput).selectByVisibleText("长沙市");
//工作单位详细地址
String friendAddrDetail = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_OTHER-COM_Detail")).sendKeys(friendAddrDetail);
//点击下一步
brws.findElement(By.xpath("//button[@data-last='提交申请']")).click();
brws.findElement(By.id("INCOME_ANNUAL")).sendKeys("30");
//每月工作收入
brws.findElement(By.id("INCOME_MONTHLY_FROM_JOB")).sendKeys("20000");
//每月其他收入
brws.findElement(By.id("INCOME_MONTHLY_FROM_OTHER")).sendKeys("5000");
//目前需要供养人数
brws.findElement(By.id("NUMS_OF_PROVIDE")).sendKeys("0");
//点击下一步
brws.findElement(By.xpath("//button[@data-last='提交申请']")).click();
//联系人资料-----------------------------------------------------------------------------
//姓名
String peiOuNameStr = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_RELATIVE1-APP_CONTACT_NAME")).sendKeys(peiOuNameStr);
//电话
String mobileNum1 = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_RELATIVE1-APP_CONTACT_MOBILE")).sendKeys(mobileNum1);
//工作单位名称
String comName1 = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_RELATIVE1-APP_CONTACT_COM_NAME")).sendKeys(comName1);
//工作单位地址省
WebElement prov1Input = brws.findElement(By.id("CONTACT_RELATIVE1-Com_Province"));
new Select(prov1Input).selectByVisibleText("湖南省");
//工作单位地址市
WebElement city1Input = brws.findElement(By.id("CONTACT_RELATIVE1-Com_City"));
new Select(city1Input).selectByVisibleText("长沙市");
//工作单位详细地址
String comAddr1 = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_RELATIVE1-Com_Detail")).sendKeys(comAddr1);
//子女
WebElement ziNvInput = brws.findElement(By.id("CONTACT_RELATIVE2-RELATIONSHIP"));
new Select(ziNvInput).selectByVisibleText("子女");
//姓名
String ziNvName = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_RELATIVE2-APP_CONTACT_NAME")).sendKeys(ziNvName);
//手机号码
String mobileNum2 = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_RELATIVE2-APP_CONTACT_MOBILE")).sendKeys(mobileNum2);
//工作单位名称
String comName2 = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_RELATIVE2-APP_CONTACT_COM_NAME")).sendKeys(comName2);
//工作单位地址省
WebElement prov2Input = brws.findElement(By.id("CONTACT_RELATIVE2_Com_Province"));
new Select(prov2Input).selectByVisibleText("湖南省");
//工作单位地址市
WebElement city2Input = brws.findElement(By.id("CONTACT_RELATIVE2_Com_City"));
new Select(city2Input).selectByVisibleText("长沙市");
//工作单位详细地址
String comAddr2 = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_RELATIVE2_Com_Detail")).sendKeys(comAddr2);
//同事
WebElement colleageInput = brws.findElement(By.id("CONTACT_JOB_CERT-RELATIONSHIP"));
new Select(colleageInput).selectByVisibleText("同事");
//同事姓名
String colleageName = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_JOB_CERT-APP_CONTACT_NAME")).sendKeys(colleageName);
//手机号码
String colleageMob = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_JOB_CERT-APP_CONTACT_MOBILE")).sendKeys(colleageMob);
//部门
String colleageDepart = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_JOB_CERT-COM_DEPT")).sendKeys(colleageDepart);
//职位
String positDepart = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_JOB_CERT-COM_POSITION")).sendKeys(positDepart);
//朋友
WebElement friendInput = brws.findElement(By.id("CONTACT_OTHER-RELATIONSHIP"));
new Select(friendInput).selectByVisibleText("朋友");
//朋友姓名
String friendName = StringRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_OTHER-APP_CONTACT_NAME")).sendKeys(friendName);
//手机号码
String friendMob = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("CONTACT_OTHER-APP_CONTACT_MOBILE")).sendKeys(friendMob);
//工作单位名称
String friendCom = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_OTHER-APP_CONTACT_COM_NAME")).sendKeys(friendCom);
//工作单位地址省
WebElement friendAddrProInput = brws.findElement(By.id("CONTACT_OTHER-COM_Province"));
new Select(friendAddrProInput).selectByVisibleText("湖南省");
//工作单位地址市
WebElement friendAddrCityInput = brws.findElement(By.id("CONTACT_OTHER-COM_City"));
new Select(friendAddrCityInput).selectByVisibleText("长沙市");
//工作单位详细地址
String friendAddrDetail = StringRandom.getRandomString(20);
brws.findElement(By.id("CONTACT_OTHER-COM_Detail")).sendKeys(friendAddrDetail);
//点击下一步
brws.findElement(By.xpath("//button[@data-last='提交申请']")).click();
//备注-----------------------------------------------------------------
String memoStr = StringRandom.getRandomString(8);
brws.findElement(By.id("MEMO_MEMO")).sendKeys(memoStr);
//点击下一步
Thread.sleep(1000);
brws.findElement(By.xpath("//button[@data-last='提交申请']")).click();
//所属银行---------------------------------------------------------------------
WebElement bankFromInput = new WebDriverWait(brws,30).until(ExpectedConditions.visibilityOfElementLocated(By.id("BankName")));
new Select(bankFromInput).selectByVisibleText("中国银行");
//银行卡号工商银行
String bankCardStr = "621785" + NumRandom.getRandomString(13);
brws.findElement(By.id("BankCardID")).sendKeys(bankCardStr);
//银行预留手机号
String bankMobileStr = "140" + NumRandom.getRandomString(8);
brws.findElement(By.id("BankMobile")).sendKeys(bankMobileStr);
//开户行所在地省
WebElement bankProInput = brws.findElement(By.id("Bank_Province"));
new Select(bankProInput).selectByVisibleText("湖南省");
//开户行所在地市
WebElement bankCityInput = brws.findElement(By.id("Bank_City"));
new Select(bankCityInput).selectByVisibleText("长沙市");
//开户行所在地详细地址
String bankAddrDetail = StringRandom.getRandomString(20);
brws.findElement(By.id("Bank_Detail")).sendKeys(bankAddrDetail);
//点击下一步
Thread.sleep(1000);
brws.findElement(By.xpath("//button[@data-last='提交申请']")).click();
//征信渠道-------------------------------------------------------------------
WebElement creditChannelInput = new WebDriverWait(brws,30).until(ExpectedConditions.visibilityOfElementLocated(By.id("CREDIT_CHANNEL_CODE")));
new Select(creditChannelInput).selectByVisibleText("其他");
Thread.sleep(1000);
//客户经理
String setManager = "var manager = document.getElementById(\"StaffOnlySales\");" +
"manager.removeAttribute('readonly');" +
"manager.value = \"app;\";" +
"document.getElementById(\"StaffOnlySales_hidden\").value=\"app;\";";
((JavascriptExecutor)brws).executeScript(setManager);
//点击下一步
Thread.sleep(1000);
brws.findElement(By.xpath("//button[@data-last='提交申请']")).click();
//上传文件-----------------------------------------------------------------------------------
//上传身份证
UploadFile.uploadAndClose(brws, "Id1", "5");
//夸克申请表
UploadFile.uploadAndClose(brws, "fileTypeApp1", "6");
//房居住地产证
UploadFile.uploadAndClose(brws, "addrHouseForResidentAddr", "7");
//对公账户流水
UploadFile.uploadAndClose(brws, "incomeBizAccount", "8");
//房产证和各种缴费单据
UploadFile.uploadAndClose(brws, "housecard_manyPaper", "9");
//企业法人营业执照
UploadFile.uploadAndClose(brws, "Business_license_enterprise", "10");
//银行卡正面
UploadFile.uploadAndClose(brws, "bank_card_front", "11");
//委托查询书
for(int i=0;i<2;i++){
UploadFile.uploadAndClose(brws, "Pboc2", "12");
}
//2.0版征信报告
UploadFile.uploadAndClose(brws, "Pbocv2", "13");
//通话详情
UploadFile.uploadAndClose(brws, "fileTypeMobileHistforMobileHist", "14");
//客户与销售的合影
UploadFile.uploadAndClose(brws, "salesCustomerPhoto", "15");
//提交申请
Thread.sleep(2000);
brws.findElement(By.xpath("//button[@data-last='提交申请']")).click();
Thread.sleep(2000);
//退出浏览器
// Thread.sleep(2000);
// brws.quit();
// server.stop();
}
}
TAG:
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
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 |
我的存档
数据统计
- 访问量: 44415
- 日志数: 51
- 建立时间: 2014-05-05
- 更新时间: 2018-07-13