List of usage examples for org.openqa.selenium WebElement sendKeys
void sendKeys(CharSequence... keysToSend);
From source file:com.coinbot.core.InputAddressDetector.java
License:Open Source License
public void insertAddress(String address) { List<WebElement> inputs = driver.findElements(By.tagName("input")); for (WebElement input : inputs) { if (input.getAttribute("name").length() > 20) { input.sendKeys(address); }/*from ww w. j av a 2s . c om*/ } }
From source file:com.comcast.dawg.house.AdvanceFilterNavigator.java
License:Apache License
/** * Adds a condition to the condition list. By putting the given values in the * html fields and clicking the add condition button * @param field The field to select in the select list * @param op The operator to select in the select list * @param value The value to put in the text input field *///from w w w .j a v a 2 s . c om public void addCondition(String field, String op, String value) { Select fieldSelect = new Select(driver.findElementByClassName(IndexPage.FIELD_SELECT)); fieldSelect.selectByVisibleText(field); Select opSelect = new Select(driver.findElementByClassName(IndexPage.OP_SELECT)); opSelect.selectByVisibleText(op); WebElement fvInput = driver.findElementByClassName(IndexPage.FIELD_VALUE_INPUT); fvInput.sendKeys(value); driver.findElementByClassName(IndexPage.BTN_ADD_CONDITION).click(); }
From source file:com.comcast.dawg.house.EditDeviceOverlay.java
License:Apache License
/** * Adds a property by inputing the key and then clicking add * @param key The key to add// w w w .ja va 2 s . c om * @param set true if the Set check mark should be checked * @param byButton true if the property is added by clicking the button, false if it is by pushing enter */ public void addProp(String key, boolean set, boolean byButton) { WebElement keyInp = overlayUI.findElement(By.className(NEW_PROP_KEY)); keyInp.sendKeys(key); WebElement setCb = overlayUI.findElement(By.className(CB_NEW_PROP_SET)); if (setCb.isSelected() != set) { setCb.click(); } if (byButton) { overlayUI.findElement(By.className(BTN_ADD_PROP)).click(); } else { keyInp.click(); driver.getKeyboard().pressKey(Keys.ENTER); } }
From source file:com.comcast.dawg.house.EditDeviceRow.java
License:Apache License
/** * Changes the value in the <textarea> element * @param newValue/*from w w w . j a v a 2s. c o m*/ */ public void changeValue(String newValue) { WebElement valueInput = valueInput(); valueInput.clear(); valueInput.sendKeys(newValue); }
From source file:com.comcast.dawg.house.pages.IndexPage.java
License:Apache License
/** * Type the tag name on text input element field. * * @param tagName Name of tag to be entered on text input field. *///from www . j ava 2 s.com public void typeOnBulkTagTextElement(String tagName) { WebElement elementTagText = getBulkTagTextElement(); // Clearing the text area before entering. elementTagText.clear(); elementTagText.sendKeys(tagName); }
From source file:com.comcast.dawg.house.pages.ModelPage.java
License:Apache License
/** * Type the model name to text input element in model overlay. * * @param modelName Model name to be added. *//*from www. ja va 2s. co m*/ public void typeModelNameOnAlreadyLoadedModelOverlay(String modelName) { WebElement modelNameTextInput = getModelNameTextInputElement(); modelNameTextInput.sendKeys(modelName); }
From source file:com.consensus.qa.verizon.tests.ExchangeTests.java
@Test(groups = { "verizon" }) @Parameters("test-type") public void QA_51_VerizonNonEdgeExchangeLikeForUnlike(@Optional String testtype) throws IOException, InterruptedException, AWTException { DependantTestCaseInputs dependantValues = Utilities.ReadFromCSV("QA_50"); if (dependantValues.TC_ID == "" || dependantValues.ORDER_ID == "") { AddNewLineTests addNewLine = new AddNewLineTests(); addNewLine.QA50_VerizonNonEdgeWithNumberPortCCInCA(BrowserSettings.readConfig("test-type")); dependantValues = Utilities.ReadFromCSV("QA_50"); if (dependantValues.TC_ID == "" || dependantValues.ORDER_ID == "") { Reporter.log("<br> Data is not available from QA_50"); Assert.fail("Data is not available from QA_50"); }//www . j a v a 2 s . c o m } String ChildOrderId = null; String newIMEI1 = PageBase.CSVOperations() .GetIMEIOrSimNumberOrReceiptId(FileName.SamsungGalaxyS4_16GBWhite); String newIMEI2 = PageBase.CSVOperations() .GetIMEIOrSimNumberOrReceiptId(FileName.SamsungGalaxyS4_16GBWhite); String simType1 = PageBase.CSVOperations().GetIMEIOrSimNumberOrReceiptId(FileName.Sim_3FF); String simType2 = PageBase.CSVOperations().GetIMEIOrSimNumberOrReceiptId(FileName.Sim_3FF); String testType = BrowserSettings.readConfig("test-type"); Reporter.log("QA_51_VerizonNonEdgeLikeForUnlike Starts."); Reporter.log("<br>Launching Browser"); Log.startTestCase("QA_51_VerizonNonEdgeExchange_LikeForUnlike"); //Carrier and Test Type Settings SetTestTypeForQA_51(testType); String receiptId = dependantValues.RECEIPT_ID; Utilities.switchPreviousTab(); //Calling DBError utility to find initial count or error in log files. DBError.navigateDBErrorPage(); int initialCount = PageBase.AdminPage().totalErrorCount(); Utilities.switchPreviousTab(); PageBase.LoginPageRetail().poaLogin(Utilities.getCredentials("tuserUN"), Utilities.getCredentials("tuserPwd"), Utilities.getCredentials("storeId0003")); Reporter.log("Returning the device using Receipt ID: "); PageBase.HomePageRetail().newGuestButton.click(); PageBase.HomePageRetail().guestLookupTab.click(); PageBase.CustomerLookupPage().receiptIdTextbox.sendKeys(receiptId); Reporter.log(receiptId); List<WebElement> SubmitButtons = driver.findElements(By.xpath(ControlLocators.SUBMIT_RECEIPTID)); for (WebElement visibleSubmitButton : SubmitButtons) { if (visibleSubmitButton.isDisplayed()) { visibleSubmitButton.click(); break; } } PageBase.CarrierCreditCheckPage().firstNameTextBox.sendKeys(dependantValues.FIRST_NAME); PageBase.CarrierCreditCheckPage().lastNameTextBox.sendKeys(dependantValues.LAST_NAME); Reporter.log("<br>First Name: " + dependantValues.FIRST_NAME); Reporter.log(" Last Name: " + dependantValues.LAST_NAME + "; "); SelectLicense(dependantValues.ID_TYPE, PageBase.ReturnOrExchangeVerificationPage().idTypeDropdown); Reporter.log("State: " + dependantValues.STATE + "; "); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().stateDropdown, SelectDropMethod.SELECTBYTEXT, dependantValues.STATE); Reporter.log("ID Type: " + dependantValues.ID_TYPE + "; "); PageBase.ReturnOrExchangeVerificationPage().idNumberTextbox.sendKeys(dependantValues.ID_NUMBER); Reporter.log("ID Number: " + dependantValues.ID_NUMBER + "."); PageBase.CommonControls().continueCommonButton.click(); Utilities.waitForElementVisible(PageBase.ReturnScanDevicePage().esnIemeidTextbox); PageBase.ReturnScanDevicePage().esnIemeidTextbox.click(); PageBase.ReturnScanDevicePage().esnIemeidTextbox.clear(); PageBase.ReturnScanDevicePage().esnIemeidTextbox.sendKeys(dependantValues.ESN_IMEI1); PageBase.ReturnOrExchangeVerificationPage().continueEXCHANGE.click(); SelectPreConditions(); Reporter.log("<br>Pre Conditions Set for First Device"); PageBase.ReturnOrExchangeVerificationPage().continuePRECONDITION.click(); PageBase.ReturnOrExchangeVerificationPage().proceedEXCHANGE.click(); PageBase.ReturnOrExchangeVerificationPage().exchangeDEVICE.click(); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().financingOptIn, SelectDropMethod.SELECTBYINDEX, "2"); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons, SelectDropMethod.SELECTBYINDEX, "1"); WebElement newESNBox = driver.findElement(By.id("addDeviceId")); newESNBox.click(); newESNBox.clear(); newESNBox.sendKeys(newIMEI1); PageBase.ReturnOrExchangeVerificationPage().submitFormButton.click(); Thread.sleep(2000); Utilities.waitForElementVisible(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons, SelectDropMethod.SELECTBYINDEX, "1"); Utilities.waitForElementVisible(PageBase.ReturnOrExchangeVerificationPage().returnAnotherDevice); PageBase.ReturnOrExchangeVerificationPage().returnAnotherDevice.click(); Utilities.waitForElementVisible(PageBase.ReturnScanDevicePage().esnIemeidTextbox); PageBase.ReturnScanDevicePage().esnIemeidTextbox.click(); PageBase.ReturnScanDevicePage().esnIemeidTextbox.clear(); PageBase.ReturnScanDevicePage().esnIemeidTextbox.sendKeys(dependantValues.ESN_IMEI2); PageBase.ReturnOrExchangeVerificationPage().continueEXCHANGE.click(); SelectPreConditions(); Reporter.log("<br>Pre Conditions Set for Second Device"); PageBase.ReturnOrExchangeVerificationPage().continuePRECONDITION.click(); PageBase.ReturnOrExchangeVerificationPage().proceedEXCHANGE.click(); PageBase.ReturnOrExchangeVerificationPage().exchangeDEVICE.click(); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().financingOptIn, SelectDropMethod.SELECTBYINDEX, "2"); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons, SelectDropMethod.SELECTBYINDEX, "1"); newESNBox = driver.findElement(By.id("addDeviceId")); newESNBox.click(); newESNBox.clear(); newESNBox.sendKeys(newIMEI2); PageBase.ReturnOrExchangeVerificationPage().submitFormButton.click(); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons, SelectDropMethod.SELECTBYINDEX, "1"); PageBase.ReturnOrExchangeVerificationPage().continueEXCHANGE.click(); PageBase.VerizonSelectPlanFeaturesPage().continueSPFButton.click();//driver.findElement(By.id("featureSubmit")).click(); Thread.sleep(1000); Utilities.ScrollToElement(PageBase.ReturnOrExchangeVerificationPage().firstDeviceNoInsurance); Thread.sleep(500); PageBase.ReturnOrExchangeVerificationPage().firstDeviceNoInsurance.click(); PageBase.ReturnOrExchangeVerificationPage().firstDeviceNoInsurance.click(); Thread.sleep(500); PageBase.ReturnOrExchangeVerificationPage().secondDeviceNoInsurance.click(); PageBase.ReturnOrExchangeVerificationPage().secondDeviceNoInsurance.click(); driver.findElement(By.xpath(".//*[@id='guestReview']/div/div/label/span")).click(); PageBase.CommonControls().continueButton.click(); Utilities.waitForElementVisible(PageBase.CommonControls().continueCommonButton); Utilities.ScrollToElement(PageBase.CommonControls().continueCommonButton); if (BrowserSettings.readConfig("Activation") == "true") { PageBase.CommonControls().continueCommonButton.click(); if (driver.getCurrentUrl().contains("payment")) { PageBase.PaymentRequiredPage().populatingCardDetailsPaymentRequired(CardType.VISA); Utilities.ClickElement(PageBase.PaymentRequiredPage().sameAddressTab); Utilities.ClickElement(PageBase.PaymentRequiredPage().continuePRButton); } ChildOrderId = PageBase.PrintMobileScanSheetPage().orderNumberValuePMSSText.getText(); Reporter.log("Child Order Created!!! <br> <p>" + ChildOrderId); PageBase.ReturnOrExchangeVerificationPage().continueExchangeMSSPage.click(); PageBase.ReturnOrExchangeVerificationPage().continueExchangeMSSPage.click(); Utilities.implicitWaitSleep(1000); PageBase.PrintMobileScanSheetPage().continueFirstMSSButton.click(); PageBase.PrintMobileScanSheetPage().continueFirstMSSButton.click(); PageBase.PaymentVerificationPage().textboxTargetReceiptID.sendKeys(receiptId); PageBase.PaymentVerificationPage().submitButton.click(); Reporter.log("Re-check Receipt ID - Successful <br> <p>"); Utilities.waitForElementVisible(PageBase.DeviceVerificationaandActivation().deviceIMEITextbox); PageBase.DeviceVerificationaandActivation().deviceIMEITextbox.sendKeys(newIMEI1); PageBase.DeviceVerificationaandActivation().submitDVAButton.click(); driver.findElement(By.id(PageBase.DeviceVerificationaandActivation().simTypeM + newIMEI1)).click(); driver.findElement(By.id(PageBase.DeviceVerificationaandActivation().simTypeM + newIMEI1)) .sendKeys(simType1); Utilities.ScrollToElement(PageBase.DeviceVerificationaandActivation().deviceIMEITextbox); PageBase.DeviceVerificationaandActivation().deviceIMEITextbox.sendKeys(newIMEI2); PageBase.DeviceVerificationaandActivation().submitDVAButton.click(); driver.findElement(By.id(PageBase.DeviceVerificationaandActivation().simTypeM + newIMEI2)).click(); driver.findElement(By.id(PageBase.DeviceVerificationaandActivation().simTypeM + newIMEI2)) .sendKeys(simType2); PageBase.CommonControls().continueButtonDVA.click(); Thread.sleep(30000); Utilities.waitForElementVisible( driver.findElement(By.xpath(".//*[@id='retailPage']/section/form/span/div/button"))); String SupportCenterMessage = driver.findElement(By.xpath(".//*[@id='retailPage']/section/p")) .getText(); Reporter.log(" <br> <p> Support Center Message: " + SupportCenterMessage + " <br> <p>"); String toCompare = Constants.SUPPORT_PAGE_MESSAGE + "#" + ChildOrderId + " when calling."; Reporter.log(toCompare + " <br> <p>"); //Assert.assertTrue(SupportCenterMessage.contains(toCompare)); ShipAdminBaseClass.launchShipAdminInNewTab(); Reporter.log("Navigating to Parent Order: " + dependantValues.ORDER_ID + " <br> <p>"); PageBase.OrderSummaryPage().goToOrderSummaryPage(dependantValues.ORDER_ID); String eventLogTableContent = PageBase.OrderSummaryPage().checkForErrorAndLog(dependantValues.ORDER_ID); String parentOrderstatus = PageBase.OrderSummaryPage().getOrderStatus(); Assert.assertEquals(parentOrderstatus, Constants.SHIPPED); Assert.assertEquals(PageBase.OrderSummaryPage().getChildOrderId(), ChildOrderId); Assert.assertTrue(eventLogTableContent.contains(ChildOrderId)); PageBase.OrderSummaryPage().rOCHomeLink.click(); Reporter.log("Navigating to Child Order: " + ChildOrderId + " <br> <p>"); PageBase.OrderSummaryPage().goToOrderSummaryPage(ChildOrderId); eventLogTableContent = PageBase.OrderSummaryPage().checkForErrorAndLog(ChildOrderId); Assert.assertTrue(eventLogTableContent .contains("Old OrdId# " + dependantValues.ORDER_ID + ", Exchange order created")); String ChildOrderstatus = PageBase.OrderSummaryPage().getOrderStatus(); Assert.assertTrue(ChildOrderstatus.contains("In-Store Activation"), "Checking for In-store activation String failed"); Assert.assertEquals(PageBase.ReturnOrExchangeVerificationPage().parentOrderNumber.getText(), dependantValues.ORDER_ID, "Parent Order on Child Order is not the correct one. Check! <br> <p>"); eventLogTableContent = PageBase.OrderSummaryPage().checkForErrorAndLog(ChildOrderId); PageBase.InventoryManagementPage().launchInventoryInNewTab(); PageBase.InventoryManagementPage().verifyDeviceStatus(dependantValues.ESN_IMEI1, dependantValues.ESN_IMEI2, Constants.RETURN_TO_INVENTORY); } //DBError Verification DBError.navigateDBErrorPage(); Assert.assertTrue(PageBase.AdminPage().isDBErrorFound(initialCount)); }
From source file:com.consensus.test.verizon.tests.ExchangeTests.java
@Test(groups = { "verizon" }) @Parameters("test-type") public void QA_51_VerizonNonEdgeExchangeLikeForUnlike(@Optional String testtype) throws IOException, InterruptedException, AWTException { DependantTestCaseInputs dependantValues = Utilities.ReadFromCSV("QA_50"); if (dependantValues.TC_ID == "" || dependantValues.ORDER_ID == "") { AddNewLineTests addNewLine = new AddNewLineTests(); addNewLine.QA50_VerizonNonEdgeWithNumberPortCCInCA(BrowserSettings.readConfig("test-type")); dependantValues = Utilities.ReadFromCSV("QA_50"); if (dependantValues.TC_ID == "" || dependantValues.ORDER_ID == "") { Reporter.log("<br> Data is not available from QA_50"); Assert.fail("Data is not available from QA_50"); }/*from w ww .ja v a 2 s .c o m*/ } String ChildOrderId = null; String newIMEI1 = PageBase.CSVOperations() .GetIMEIOrSimNumberOrReceiptId(FileName.SamsungGalaxyS4_16GBWhite); String newIMEI2 = PageBase.CSVOperations() .GetIMEIOrSimNumberOrReceiptId(FileName.SamsungGalaxyS4_16GBWhite); String simType1 = PageBase.CSVOperations().GetIMEIOrSimNumberOrReceiptId(FileName.Sim_3FF); String simType2 = PageBase.CSVOperations().GetIMEIOrSimNumberOrReceiptId(FileName.Sim_3FF); String testType = BrowserSettings.readConfig("test-type"); Reporter.log("QA_51_VerizonNonEdgeLikeForUnlike Starts."); Reporter.log("<br>Launching Browser"); Log.startTestCase("QA_51_VerizonNonEdgeExchange_LikeForUnlike"); if (testType.equals("internal")) { AdminBaseClass adminBaseClass = new AdminBaseClass(); adminBaseClass.launchAdminInNewTab(); PageBase.AdminPage().navigateToSimulator(); if (readConfig("internalTestType").toLowerCase().equals("carrierresponder")) { Reporter.log("Using Carrier Responder <br> <p>", true); PageBase.AdminPage().selectWebAPIResponse("Verizon", "CarrierResponder"); PageBase.AdminPage().selectAPIConfig("Verizon"); Utilities.waitForElementVisible(PageBase.CarrierResponseXMLPage().verizonCarrierTab); PageBase.CarrierResponseXMLPage().verizonCarrierTab.click(); Utilities.waitForElementVisible(PageBase.CarrierResponseXMLPage().versionsDropdown); PageBase.CarrierResponseXMLPage().selectOptions("current", "returnOrExchangeDevice", "default_exchange.xml"); Reporter.log("<br>XML Used: returnOrExchangeDevice - default_exchange.xml", true); Utilities.waitForElementVisible(PageBase.CarrierResponseXMLPage().saveResponseButton); PageBase.CarrierResponseXMLPage().saveResponseButton.click(); Reporter.log("<br>Carrier Responder Changes Done!!!", true); } } else //External { AdminBaseClass adminBaseClass = new AdminBaseClass(); adminBaseClass.launchAdminInNewTab(); PageBase.AdminPage().navigateToSimulator(); PageBase.AdminPage().selectWebAPIResponse("Verizon", "External"); Reporter.log("<br><U>Pointing to External Server</U>"); } String receiptId = dependantValues.RECEIPT_ID; Utilities.switchPreviousTab(); //Calling DBError utility to find initial count or error in log files. DBError.navigateDBErrorPage(); int initialCount = PageBase.AdminPage().totalErrorCount(); Utilities.switchPreviousTab(); PageBase.LoginPageRetail().poaLogin(Utilities.getCredentials("tuserUN"), Utilities.getCredentials("tuserPwd"), Utilities.getCredentials("storeId0003")); Reporter.log("Returning the device using Receipt ID: "); PageBase.HomePageRetail().newGuestButton.click(); PageBase.HomePageRetail().guestLookupTab.click(); PageBase.CustomerLookupPage().receiptIdTextbox.sendKeys(receiptId); Reporter.log(receiptId); List<WebElement> SubmitButtons = driver.findElements(By.xpath(ControlLocators.SUBMIT_RECEIPTID)); for (WebElement visibleSubmitButton : SubmitButtons) { if (visibleSubmitButton.isDisplayed()) { visibleSubmitButton.click(); break; } } PageBase.CarrierCreditCheckPage().firstNameTextBox.sendKeys(dependantValues.FIRST_NAME); PageBase.CarrierCreditCheckPage().lastNameTextBox.sendKeys(dependantValues.LAST_NAME); Reporter.log("<br>First Name: " + dependantValues.FIRST_NAME); Reporter.log(" Last Name: " + dependantValues.LAST_NAME + "; "); SelectLicense(dependantValues.ID_TYPE, PageBase.ReturnOrExchangeVerificationPage().idTypeDropdown); Reporter.log("State: " + dependantValues.STATE + "; "); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().stateDropdown, SelectDropMethod.SELECTBYTEXT, dependantValues.STATE); Reporter.log("ID Type: " + dependantValues.ID_TYPE + "; "); PageBase.ReturnOrExchangeVerificationPage().idNumberTextbox.sendKeys(dependantValues.ID_NUMBER); Reporter.log("ID Number: " + dependantValues.ID_NUMBER + "."); PageBase.CommonControls().continueCommonButton.click(); Utilities.waitForElementVisible(PageBase.ReturnScanDevicePage().esnIemeidTextbox); PageBase.ReturnScanDevicePage().esnIemeidTextbox.click(); PageBase.ReturnScanDevicePage().esnIemeidTextbox.clear(); PageBase.ReturnScanDevicePage().esnIemeidTextbox.sendKeys(dependantValues.ESN_IMEI1); PageBase.ReturnOrExchangeVerificationPage().continueEXCHANGE.click(); SelectPreConditions(); Reporter.log("<br>Pre Conditions Set for First Device"); PageBase.ReturnOrExchangeVerificationPage().continuePRECONDITION.click(); PageBase.ReturnOrExchangeVerificationPage().proceedEXCHANGE.click(); PageBase.ReturnOrExchangeVerificationPage().exchangeDEVICE.click(); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().financingOptIn, SelectDropMethod.SELECTBYINDEX, "2"); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons, SelectDropMethod.SELECTBYINDEX, "1"); WebElement newESNBox = driver.findElement(By.id("addDeviceId")); newESNBox.click(); newESNBox.clear(); newESNBox.sendKeys(newIMEI1); PageBase.ReturnOrExchangeVerificationPage().submitFormButton.click(); Thread.sleep(2000); Utilities.waitForElementVisible(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons, SelectDropMethod.SELECTBYINDEX, "1"); Utilities.waitForElementVisible(PageBase.ReturnOrExchangeVerificationPage().returnAnotherDevice); PageBase.ReturnOrExchangeVerificationPage().returnAnotherDevice.click(); Utilities.waitForElementVisible(PageBase.ReturnScanDevicePage().esnIemeidTextbox); PageBase.ReturnScanDevicePage().esnIemeidTextbox.click(); PageBase.ReturnScanDevicePage().esnIemeidTextbox.clear(); PageBase.ReturnScanDevicePage().esnIemeidTextbox.sendKeys(dependantValues.ESN_IMEI2); PageBase.ReturnOrExchangeVerificationPage().continueEXCHANGE.click(); SelectPreConditions(); Reporter.log("<br>Pre Conditions Set for Second Device"); PageBase.ReturnOrExchangeVerificationPage().continuePRECONDITION.click(); PageBase.ReturnOrExchangeVerificationPage().proceedEXCHANGE.click(); PageBase.ReturnOrExchangeVerificationPage().exchangeDEVICE.click(); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().financingOptIn, SelectDropMethod.SELECTBYINDEX, "2"); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons, SelectDropMethod.SELECTBYINDEX, "1"); newESNBox = driver.findElement(By.id("addDeviceId")); newESNBox.click(); newESNBox.clear(); newESNBox.sendKeys(newIMEI2); PageBase.ReturnOrExchangeVerificationPage().submitFormButton.click(); Utilities.dropdownSelect(PageBase.ReturnOrExchangeVerificationPage().exchangeReasons, SelectDropMethod.SELECTBYINDEX, "1"); PageBase.ReturnOrExchangeVerificationPage().continueEXCHANGE.click(); PageBase.VerizonSelectPlanFeaturesPage().continueSPFButton.click();//driver.findElement(By.id("featureSubmit")).click(); Thread.sleep(1000); Utilities.ScrollToElement(PageBase.ReturnOrExchangeVerificationPage().firstDeviceNoInsurance); Thread.sleep(500); PageBase.ReturnOrExchangeVerificationPage().firstDeviceNoInsurance.click(); PageBase.ReturnOrExchangeVerificationPage().firstDeviceNoInsurance.click(); Thread.sleep(500); PageBase.ReturnOrExchangeVerificationPage().secondDeviceNoInsurance.click(); PageBase.ReturnOrExchangeVerificationPage().secondDeviceNoInsurance.click(); driver.findElement(By.xpath(".//*[@id='guestReview']/div/div/label/span")).click(); PageBase.CommonControls().continueButton.click(); Utilities.waitForElementVisible(PageBase.CommonControls().continueCommonButton); Utilities.ScrollToElement(PageBase.CommonControls().continueCommonButton); if (BrowserSettings.readConfig("Activation") == "true") { PageBase.CommonControls().continueCommonButton.click(); if (driver.getCurrentUrl().contains("payment")) { PageBase.PaymentRequiredPage().populatingCardDetailsPaymentRequired(CardType.VISA); Utilities.ClickElement(PageBase.PaymentRequiredPage().sameAddressTab); Utilities.ClickElement(PageBase.PaymentRequiredPage().continuePRButton); } ChildOrderId = PageBase.PrintMobileScanSheetPage().orderNumberValuePMSSText.getText(); Reporter.log("Child Order Created!!! <br> <p>" + ChildOrderId); PageBase.ReturnOrExchangeVerificationPage().continueExchangeMSSPage.click(); PageBase.ReturnOrExchangeVerificationPage().continueExchangeMSSPage.click(); Utilities.implicitWaitSleep(1000); PageBase.PrintMobileScanSheetPage().continueFirstMSSButton.click(); PageBase.PrintMobileScanSheetPage().continueFirstMSSButton.click(); PageBase.PaymentVerificationPage().textboxTargetReceiptID.sendKeys(receiptId); PageBase.PaymentVerificationPage().submitButton.click(); Reporter.log("Re-check Receipt ID - Successful <br> <p>"); Utilities.waitForElementVisible(PageBase.DeviceVerificationaandActivation().deviceIMEITextbox); PageBase.DeviceVerificationaandActivation().deviceIMEITextbox.sendKeys(newIMEI1); PageBase.DeviceVerificationaandActivation().submitDVAButton.click(); driver.findElement(By.id(PageBase.DeviceVerificationaandActivation().simTypeM + newIMEI1)).click(); driver.findElement(By.id(PageBase.DeviceVerificationaandActivation().simTypeM + newIMEI1)) .sendKeys(simType1); Utilities.ScrollToElement(PageBase.DeviceVerificationaandActivation().deviceIMEITextbox); PageBase.DeviceVerificationaandActivation().deviceIMEITextbox.sendKeys(newIMEI2); PageBase.DeviceVerificationaandActivation().submitDVAButton.click(); driver.findElement(By.id(PageBase.DeviceVerificationaandActivation().simTypeM + newIMEI2)).click(); driver.findElement(By.id(PageBase.DeviceVerificationaandActivation().simTypeM + newIMEI2)) .sendKeys(simType2); PageBase.CommonControls().continueButtonDVA.click(); Thread.sleep(30000); Utilities.waitForElementVisible( driver.findElement(By.xpath(".//*[@id='retailPage']/section/form/span/div/button"))); String SupportCenterMessage = driver.findElement(By.xpath(".//*[@id='retailPage']/section/p")) .getText(); Reporter.log(" <br> <p> Support Center Message: " + SupportCenterMessage + " <br> <p>"); String toCompare = Constants.SUPPORT_PAGE_MESSAGE + "#" + ChildOrderId + " when calling."; Reporter.log(toCompare + " <br> <p>"); //Assert.assertTrue(SupportCenterMessage.contains(toCompare)); ShipAdminBaseClass.launchShipAdminInNewTab(); Reporter.log("Navigating to Parent Order: " + dependantValues.ORDER_ID + " <br> <p>"); PageBase.OrderSummaryPage().goToOrderSummaryPage(dependantValues.ORDER_ID); String eventLogTableContent = PageBase.OrderSummaryPage().checkForErrorAndLog(dependantValues.ORDER_ID); String parentOrderstatus = PageBase.OrderSummaryPage().getOrderStatus(); Assert.assertEquals(parentOrderstatus, Constants.SHIPPED); Assert.assertEquals(PageBase.OrderSummaryPage().getChildOrderId(), ChildOrderId); Assert.assertTrue(eventLogTableContent.contains(ChildOrderId)); PageBase.OrderSummaryPage().rOCHomeLink.click(); Reporter.log("Navigating to Child Order: " + ChildOrderId + " <br> <p>"); PageBase.OrderSummaryPage().goToOrderSummaryPage(ChildOrderId); eventLogTableContent = PageBase.OrderSummaryPage().checkForErrorAndLog(ChildOrderId); Assert.assertTrue(eventLogTableContent .contains("Old OrdId# " + dependantValues.ORDER_ID + ", Exchange order created")); String ChildOrderstatus = PageBase.OrderSummaryPage().getOrderStatus(); Assert.assertTrue(ChildOrderstatus.contains("In-Store Activation"), "Checking for In-store activation String failed"); Assert.assertEquals(PageBase.ReturnOrExchangeVerificationPage().parentOrderNumber.getText(), dependantValues.ORDER_ID, "Parent Order on Child Order is not the correct one. Check! <br> <p>"); eventLogTableContent = PageBase.OrderSummaryPage().checkForErrorAndLog(ChildOrderId); PageBase.InventoryManagementPage().launchInventoryInNewTab(); PageBase.InventoryManagementPage().verifyDeviceStatus(dependantValues.ESN_IMEI1, dependantValues.ESN_IMEI2, Constants.RETURN_TO_INVENTORY); } //DBError Verification DBError.navigateDBErrorPage(); Assert.assertTrue(PageBase.AdminPage().isDBErrorFound(initialCount)); }
From source file:com.consol.citrus.selenium.actions.SetInputAction.java
License:Apache License
@Override protected void execute(WebElement webElement, SeleniumBrowser browser, TestContext context) { super.execute(webElement, browser, context); String tagName = webElement.getTagName(); if (null == tagName || !"select".equals(tagName.toLowerCase())) { webElement.clear();/*from w w w .j av a 2 s.co m*/ webElement.sendKeys(value); } else { new Select(webElement).selectByValue(value); } }
From source file:com.consol.citrus.selenium.client.WebClient.java
License:Apache License
/** * Set a value on a single input element by its id after clearing it. * * @param by/*from ww w . j a va2 s. co m*/ * @param value Value to set. */ public void setInput(By by, String value) { WebElement element = findElement(by); String tagName = element.getTagName(); if (null == tagName || !"select".equals(tagName.toLowerCase())) { element.clear(); element.sendKeys(value); } else { new Select(element).selectByValue(value); } }