Java tutorial
package cls.ui.model.selenium.loanreview; import org.apache.xmlbeans.impl.xb.xsdschema.impl.PublicImpl; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.ui.Select; import cls.ui.base.BaseWebDriver; /** * * @author zyf * @Email zhuyunfeng@zafh.com.cn */ public class BusinessEnteringPage extends BaseWebDriver { // ? @FindBy(name = "cardNoValidTime") private WebElement cardNoValidTime_textBox; // ?? @FindBy(name = "licenceIssuingAuthority") private WebElement licenceIssuingAuthority_textBox; // ? @FindBy(name = "nativePlace") private WebElement nativePlace_textBox; // ? @FindBy(name = "homePhone") private WebElement homePhone_textBox; // @FindBy(name = "yearlyIncome") private WebElement yearlyIncome_textBox; // ?? @FindBy(name = "companyName") private WebElement companyName_textBox; // ??? @FindBy(name = "companyPhone") private WebElement companyPhone_textBox; // ? @FindBy(name = "employTime") private WebElement employTime_textBox; // ?? @FindBy(name = "companyAddressDetail") private WebElement companyAddressDetail_textBox; // ? @FindBy(name = "curAddressTime") private WebElement curAddressTime_textBox; // ?? @FindBy(name = "homeAddressDetail") private WebElement homeAddressDetail_textBox; // ? @FindBy(xpath = "/html/body/div[2]/div[1]/div/div[2]/div[1]/div/div/div/form/div[4]/div[1]/div[2]/ul/li/a") private WebElement addNewContracts_btn; // ?? @FindBy(name = "xzzDiscountAmount") private WebElement xzzDiscountAmount_textBox; // ??? @FindBy(name = "emergencyContact") private WebElement emergencyContact_textBox; // ?? @FindBy(xpath = "/html/body/div[3]/div/div/div[2]/div/form/div[2]/div[1]/div/input") private WebElement mobilePhone_textBox; // ?? @FindBy(id = "btn-contacter-save") private WebElement contractsSave_btn; // ??? @FindBy(xpath = "/html/body/div[2]/div[2]/div/div/form/div[1]/div[2]/div[1]/div/div/label[1]/input") private WebElement agree_btn; // ??? ? @FindBy(xpath = "/html/body/div[2]/div[2]/div/div/form/div[1]/div[2]/div[1]/div/div/label[1]/input") private WebElement disAgree_btn; // ?? @FindBy(id = "opinionText") private WebElement opinionText_textBox; // ?tab @FindBy(xpath = "/html/body/div[2]/div[1]/div/ul/li[5]/a") private WebElement budget_panel; // ? @FindBy(id = "collectedAmount") private WebElement collectedAmount_textBox; // ?? @FindBy(id = "btn-opinion-save") private WebElement submit_btn; // ?? @FindBy(id = "sureOption") private WebElement sureOption_btn; //? public void enterCardNoValidTime(String cardNoValidTimeString) throws Throwable { Thread.sleep(2000); driver.switchTo().defaultContent(); driver.switchTo().frame("iframe_undefined"); cardNoValidTime_textBox.clear(); cardNoValidTime_textBox.sendKeys(cardNoValidTimeString); } // ?? public void enterLicenceIssuingAuthority(String licenceIssuingAuthorityString) throws Throwable { licenceIssuingAuthority_textBox.clear(); licenceIssuingAuthority_textBox.sendKeys(licenceIssuingAuthorityString); } // ? public void enterNativePlace(String nativePlaceString) throws Throwable { nativePlace_textBox.clear(); nativePlace_textBox.sendKeys(nativePlaceString); } // ? public void enterHomePhone(String homePhoneString) throws Throwable { homePhone_textBox.clear(); homePhone_textBox.sendKeys(homePhoneString); } // ? public void selectHousingStatus(String housingStatusString) throws Throwable { Thread.sleep(1000); WebElement housingStatus = driver.findElement(By.name("housingStatus")); Select mySelect = new Select(housingStatus); mySelect.selectByVisibleText(housingStatusString); } // public void selectEducation(String educationString) throws Throwable { Thread.sleep(1000); WebElement education = driver.findElement(By.name("education")); Select mySelect = new Select(education); mySelect.selectByVisibleText(educationString); } // ? public void selectProfessionCode(String professionCodeString) throws Throwable { Thread.sleep(1000); WebElement professionCode = driver.findElement(By.name("professionCode")); Select mySelect = new Select(professionCode); mySelect.selectByVisibleText(professionCodeString); } // ? public void selectPost(String postString) throws Throwable { Thread.sleep(1000); WebElement post = driver.findElement(By.name("post")); Select mySelect = new Select(post); mySelect.selectByVisibleText(postString); } // public void selectIndustry(String industryString) throws Throwable { Thread.sleep(1000); WebElement industry = driver.findElement(By.name("industry")); Select mySelect = new Select(industry); mySelect.selectByVisibleText(industryString); } // ??? public void selectWorkNatureCode(String workNatureCodeString) throws Throwable { Thread.sleep(1000); WebElement workNatureCode = driver.findElement(By.name("workNatureCode")); Select mySelect = new Select(workNatureCode); mySelect.selectByVisibleText(workNatureCodeString); } // public void selectMonthlyIncome(String monthlyIncomeString) throws Throwable { Thread.sleep(1000); WebElement monthlyIncome = driver.findElement(By.name("monthlyIncome")); Select mySelect = new Select(monthlyIncome); mySelect.selectByVisibleText(monthlyIncomeString); } // public void enterYearlyIncome(String yearlyIncomeString) throws Throwable { Thread.sleep(2000); driver.switchTo().defaultContent(); driver.switchTo().frame("iframe_undefined"); yearlyIncome_textBox.clear(); yearlyIncome_textBox.sendKeys(yearlyIncomeString); } // public void selectReservedFundsYear(String reservedFundsYearString) throws Throwable { Thread.sleep(1000); WebElement reservedFundsYear = driver.findElement(By.name("reservedFundsYear")); Select mySelect = new Select(reservedFundsYear); mySelect.selectByVisibleText(reservedFundsYearString); } // public void selectReservedFunds(String reservedFundsString) throws Throwable { Thread.sleep(1000); WebElement reservedFunds = driver.findElement(By.name("reservedFunds")); Select mySelect = new Select(reservedFunds); mySelect.selectByVisibleText(reservedFundsString); } // ? public void selectSocialYear(String socialYearString) throws Throwable { Thread.sleep(1000); WebElement socialYear = driver.findElement(By.name("socialYear")); Select mySelect = new Select(socialYear); mySelect.selectByVisibleText(socialYearString); } // ?? public void enterCompanyName(String companyNameString) throws Throwable { companyName_textBox.clear(); companyName_textBox.sendKeys(companyNameString); } // ??? public void enterCompanyPhone(String companyPhoneString) throws Throwable { companyPhone_textBox.clear(); companyPhone_textBox.sendKeys(companyPhoneString); } // ? public void enterEmployTime(String employTimeString) throws Throwable { employTime_textBox.clear(); employTime_textBox.sendKeys(employTimeString); } // ???? public void selectCompanyAddressPid(String companyAddressPidString) throws Throwable { Thread.sleep(1000); WebElement companyAddressPid = driver.findElement(By.name("companyAddressPid")); Select mySelect = new Select(companyAddressPid); mySelect.selectByVisibleText(companyAddressPidString); } // ??? public void selectCompanyAddressCid(String companyAddressCidString) throws Throwable { Thread.sleep(3000); WebElement companyAddressCid = driver.findElement(By.name("companyAddressCid")); Select mySelect = new Select(companyAddressCid); mySelect.selectByVisibleText(companyAddressCidString); } // ??? public void selectCompanyAddressRid(String companyAddressRidString) throws Throwable { Thread.sleep(3000); WebElement companyAddressRid = driver.findElement(By.name("companyAddressRid")); Select mySelect = new Select(companyAddressRid); mySelect.selectByVisibleText(companyAddressRidString); } // ? public void enterCompanyAddressDetail(String companyAddressDetailString) throws Throwable { companyAddressDetail_textBox.clear(); companyAddressDetail_textBox.sendKeys(companyAddressDetailString); } // ?? public void selectHomeAddressPid(String homeAddressPidString) throws Throwable { Thread.sleep(1000); WebElement homeAddressPid = driver.findElement(By.name("homeAddressPid")); Select mySelect = new Select(homeAddressPid); mySelect.selectByVisibleText(homeAddressPidString); } // ? public void selectHomeAddressCid(String homeAddressCidString) throws Throwable { Thread.sleep(3000); WebElement homeAddressCid = driver.findElement(By.name("homeAddressCid")); Select mySelect = new Select(homeAddressCid); mySelect.selectByVisibleText(homeAddressCidString); } // ? public void selectHomeAddressRid(String homeAddressRidString) throws Throwable { Thread.sleep(3000); WebElement homeAddressRid = driver.findElement(By.name("homeAddressRid")); Select mySelect = new Select(homeAddressRid); mySelect.selectByVisibleText(homeAddressRidString); } // ?? public void enterCurAddressTime(String curAddressTimeString) throws Throwable { curAddressTime_textBox.clear(); curAddressTime_textBox.sendKeys(curAddressTimeString); } // ? public void enterHomeAddressDetail(String homeAddressDetailString) throws Throwable { homeAddressDetail_textBox.clear(); homeAddressDetail_textBox.sendKeys(homeAddressDetailString); } // ? public void selectIsAgency(String isAgencyString) throws Throwable { Thread.sleep(1000); WebElement isAgency = driver.findElement(By.name("isAgency")); Select mySelect = new Select(isAgency); mySelect.selectByVisibleText(isAgencyString); } // ? public void clickAddNewContractsbutton() throws Throwable { Thread.sleep(2000); addNewContracts_btn.click(); } // ??? public void enterEmergencyContractsName(String emergencyContractsNameString) throws Throwable { Thread.sleep(1000); emergencyContact_textBox.clear(); emergencyContact_textBox.sendKeys(emergencyContractsNameString); } // ? public void selectEmergencyRelationship(String emergencyRelationshipString) throws Throwable { Thread.sleep(1000); WebElement emergencyRelationship = driver.findElement(By.name("relationship")); Select mySelect = new Select(emergencyRelationship); mySelect.selectByVisibleText(emergencyRelationshipString); } // ?? public void selectIsCarUser(String isCarUserString) throws Throwable { Thread.sleep(2000); WebElement isCarUser = driver.findElement(By.name("isCarUser")); Select mySelect = new Select(isCarUser); mySelect.selectByVisibleText(isCarUserString); } // ??? public void enterEmergencyMobilePhone(String emergencyMobilePhoneString) throws Throwable { Thread.sleep(2000); mobilePhone_textBox.clear(); mobilePhone_textBox.sendKeys(emergencyMobilePhoneString); } // ?? public void clickContractsSaveBtn() throws Throwable { Thread.sleep(1000); contractsSave_btn.click(); } // ??? public void selectAgreeOption(String agreeString) throws Throwable { if (agreeString.equals("??")) { agree_btn.click(); } else { disAgree_btn.click(); } } // ??? public void enterAdvice(String adviceString) throws Throwable { Thread.sleep(2000); driver.switchTo().defaultContent(); driver.switchTo().frame("iframe_undefined"); opinionText_textBox.clear(); opinionText_textBox.sendKeys(adviceString); } // ??? public void clickBudgetPanel() throws Throwable { Thread.sleep(4000); budget_panel.click(); } // ? public void selectIsPublicLicense(String isPublicLicenseString) throws Throwable { Thread.sleep(2000); WebElement isPublicLicense = driver.findElement(By.name("isPublicLicense")); Select mySelect = new Select(isPublicLicense); mySelect.selectByVisibleText(isPublicLicenseString); } // ? public void selectPaymentMethod(String paymentMethodString) throws Throwable { Thread.sleep(2000); WebElement paymentMethod = driver.findElement(By.name("paymentMethod")); Select mySelect = new Select(paymentMethod); mySelect.selectByVisibleText(paymentMethodString); } // ??? public void selectDeliveryMethod(String deliveryMethodString) throws Throwable { Thread.sleep(2000); WebElement deliveryMethod = driver.findElement(By.name("deliveryMethod")); Select mySelect = new Select(deliveryMethod); mySelect.selectByVisibleText(deliveryMethodString); } // ? public void enterCollectedAmount(String collectedAmountString) throws Throwable { collectedAmount_textBox.clear(); collectedAmount_textBox.sendKeys(collectedAmountString); } // ?? public void enterXzzDiscountAmount(String xzzDiscountAmountString) throws Throwable { Thread.sleep(2000); xzzDiscountAmount_textBox.clear(); xzzDiscountAmount_textBox.sendKeys(xzzDiscountAmountString); } // ?? public void clickSubmitButton() throws Throwable { Thread.sleep(2000); submit_btn.click(); } // ?? public void clickSureOptionButton() throws Throwable { Thread.sleep(2000); sureOption_btn.click(); Thread.sleep(2000); } }