List of usage examples for org.openqa.selenium WebElement sendKeys
void sendKeys(CharSequence... keysToSend);
From source file:FormFiller.java
private static void pseudoMain(String[] args) throws IOException { if (args.length < 3 || args.length > 5) throw new IllegalArgumentException("Usage: lastName bankName deliveryDate [firstName] [print]\n" + "e.g. Hakim Ally 01/01/2016 OR Hakim Chase 1/1/2016 William print\n"); if (args[args.length - 1].equals("print")) { print = true;//from ww w. j a v a2 s. c o m } WebDriver driver = getNewFirefoxDriver(); driver.get("https://www.dealertrack.com/default1.aspx?RefreshBy=SM"); HashMap dealerTrackData = new HashMap(); try { WebElement username = driver.findElement(By.name("username")); username.sendKeys("whakim"); WebElement pwd = driver.findElement(By.name("password")); pwd.sendKeys("keepbeepin23"); driver.findElement(By.name("login")).submit(); JavascriptExecutor jse = (JavascriptExecutor) driver; jse.executeScript("var script = document.createElement('script');\n" + "script.src = \"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js\";\n" + "document.getElementsByTagName('head')[0].appendChild(script);"); jse.executeScript("document.getElementById('iFrm').contentWindow.document.body." + "firstElementChild.contentDocument.getElementById('AppStatus').click()"); int attempts = 0; while (attempts++ < 15) { Thread.sleep(500); try { jse.executeScript("document.getElementById('iFrm').contentWindow.document.body.childNodes[2]." + "contentDocument.getElementById('txtSearchValue').value = '" + args[0] + "'"); jse.executeScript("document.getElementById('iFrm').contentWindow.document.body.childNodes[2]." + "contentDocument.getElementById('btnSearch').click();"); break; } catch (WebDriverException e) { if (attempts >= 15) e.printStackTrace(); } } jse.executeScript("document.getElementById('iFrm').contentWindow.document.body.childNodes[2]." + "contentDocument.getElementById('btnSearch').click();"); attempts = 0; String firstLenderName = null; int boxNum = -1; while (attempts++ < 10) { Thread.sleep(750); try { String boxName = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document." + "body.childNodes[2].contentDocument.getElementById('applications_ctrl" + ++boxNum + "_Tapplications_ctrl" + boxNum + "_TR').innerHTML"); int comma = boxName.indexOf(','); if (comma == -1 || !(boxName.substring(0, comma).contains(args[0]))) { boxNum--; continue; } else if (args.length > 3 && !args[3].equals("print") && !boxName.substring(comma, boxName.length()).contains(args[3])) continue; long numApplications = (long) jse .executeScript("return document.getElementById('iFrm').contentWindow.document." + "body.childNodes[2].contentDocument.getElementsByClassName('lender_decisions')[" + boxNum + "]." + "childNodes[0].childElementCount"); String firstLenderResult = (String) jse.executeScript("return document.getElementById('iFrm')." + "contentWindow.document.body.childNodes[2].contentDocument.getElementsByClassName" + "('lender_decisions')[" + boxNum + "].childNodes[0].childNodes[0].className"); firstLenderName = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementsByClassName('lender_decisions')[" + boxNum + "]." + "childNodes[0].childNodes[0].childNodes[0].innerHTML"); if (!firstLenderName.equals(args[1]) && numApplications == 1) continue; String secondLenderResult = null; if (numApplications > 1) { secondLenderResult = (String) jse.executeScript("return document.getElementById('iFrm')." + "contentWindow.document.body.childNodes[2].contentDocument.getElementsByClassName" + "('lender_decisions')[" + boxNum + "].childNodes[0].childNodes[1].className"); } if (firstLenderResult.contains("declined") && ((numApplications > 1) ? secondLenderResult.contains("declined") : secondLenderResult == null)) continue; break; } catch (WebDriverException e) { boxNum--; if (attempts >= 10) e.printStackTrace(); } } attempts = 0; String apr = null; if (args[1].equals("Chase")) { if (firstLenderName.equals("Chase")) jse.executeScript( "document.getElementById('iFrm').contentWindow.document.body.childNodes[2].contentDocument." + "getElementsByClassName('lender_decisions')[" + boxNum + "].childNodes[0].childNodes[0].childNodes[0].click()"); else jse.executeScript( "document.getElementById('iFrm').contentWindow.document.body.childNodes[2].contentDocument." + "getElementsByClassName('lender_decisions')[" + boxNum + "].childNodes[0].childNodes[1].childNodes[0].click()"); // APR while (attempts++ < 10) { Thread.sleep(1500); try { apr = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document." + "body.childNodes[2].contentDocument.getElementById('appDetails').contentDocument." + "getElementById('divHtml').childNodes[1].childNodes[1].childNodes[4].childNodes[1]." + "childNodes[5].firstElementChild.childNodes[0].childNodes[3].childNodes[3].childNodes[1]." + "childNodes[10].childNodes[3].childNodes[0].nodeValue"); break; } catch (WebDriverException e) { if (attempts >= 10) e.printStackTrace(); } } dealerTrackData.put("Text201", "JPMorgan Chase Bk"); dealerTrackData.put("fullBankName", "JPMorgan Chase Bk\nPO Box 901098\nFort Worth, TX 76101-2098"); } else if (args[1].equals("Ally")) { if (firstLenderName.equals("Ally")) jse.executeScript( "document.getElementById('iFrm').contentWindow.document.body.childNodes[2].contentDocument." + "getElementsByClassName('lender_decisions')[" + boxNum + "].childNodes[0].childNodes[0].childNodes[0].click()"); else jse.executeScript( "document.getElementById('iFrm').contentWindow.document.body.childNodes[2].contentDocument." + "getElementsByClassName('lender_decisions')[" + boxNum + "].childNodes[0].childNodes[1].childNodes[0].click()"); // APR while (attempts++ < 10) { Thread.sleep(1500); try { apr = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document." + "body.childNodes[2].contentDocument.getElementById('appDetails').contentDocument." + "getElementById('divHtml').childNodes[1].childNodes[1].childNodes[4].childNodes[1].childNodes[3]." + "childNodes[1].childNodes[2].childNodes[1].childNodes[2].childNodes[3].childNodes[1]." + "lastElementChild.childNodes[3].childNodes[0].data"); break; } catch (WebDriverException e) { if (attempts >= 10) e.printStackTrace(); } } // Lienholder Name String lienName = null; attempts = 0; for (int i = 6; lienName == null || !(lienName.contains(";") && lienName.contains("Ally")); i += 2, attempts++) { try { lienName = tryAllyBox(jse, i); } catch (WebDriverException e) { if (attempts >= 10) e.printStackTrace(); Thread.sleep(50); } } dealerTrackData.put("Text201", lienName.substring(1, lienName.indexOf(";"))); dealerTrackData.put("fullBankName", "Ally Bank\nP.O. Box 8128\nCockeysville, MD 21030"); } else throw new IOException("Unsupported bank: " + args[1] + ". Choose Chase or Ally."); dealerTrackData.put("Text15", apr.substring(0, apr.length() - 2)); Thread.sleep(1200); // Navigate to Application Info attempts = 0; while (attempts++ < 10) { Thread.sleep(50); try { jse.executeScript( "document.getElementById('iFrm').contentWindow.document.body.childNodes[2].contentDocument." + "getElementById('appDetails').contentDocument.getElementById('divBtn').childNodes[4].childNodes[1].click()"); break; } catch (WebDriverException e) { if (attempts >= 10) e.printStackTrace(); } } attempts = 0; while (attempts++ < 15) { Thread.sleep(500); try { try { jse.executeScript("document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementById('optAction_0').checked = true"); break; } catch (WebDriverException e) { jse.executeScript("document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementById('optAction_copy_0').checked = true"); break; } } catch (WebDriverException e) { if (attempts >= 15) { e.printStackTrace(); } } } attempts = 0; while (attempts++ < 10) { Thread.sleep(250); try { jse.executeScript("document.getElementById('iFrm').contentWindow.document.body.childNodes[2]." + "contentDocument.getElementById('btncontinue').click()"); break; } catch (WebDriverException e) { if (attempts >= 10) { e.printStackTrace(); } } } // Sale ID attempts = 0; String sid = null; while (attempts++ < 20) { Thread.sleep(750); try { sid = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementById('app_stock_num').value"); break; } catch (WebDriverException e) { if (attempts >= 20) { e.printStackTrace(); } } } dealerTrackData.put("Text3", sid); // Figure out what state the buyer is in dealerTrackData.put("buyerState", (String) jse.executeScript("return document.getElementById('iFrm')." + "contentWindow.document.body.childNodes[2].contentDocument.getElementById('app_state').value")); // Buyer Name and Address String firstName = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_first_name').value"); String lastName = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_last_name').value"); // Store applicant's name for PDF naming String fullName = firstName + " " + lastName; dealerTrackData.put("fullName", fullName); String address0 = (String) jse.executeScript("return ((document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_street_num').value).concat(' '))." + "concat(document.getElementById('iFrm').contentWindow.document.body.childNodes[2].contentDocument." + "getElementById('app_street_name').value)"); String aptNum = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_apt_num').value"); if (!aptNum.equals("")) address0 = address0 + " " + aptNum; String city = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_city').value"); String state = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_state').value"); String zipCode = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_zip_code').value"); dealerTrackData.put("Text5", fullName + "\n" + address0 + "\n" + city + ", " + state + " " + zipCode); // Fill Name/Address Lines in Ally Credit App + Confirmation of Insurance, if applicable if (args[1].equals("Ally") || dealerTrackData.get("buyerState").equals("TX")) { dealerTrackData.put("Last Name (or trade name of business)", lastName); dealerTrackData.put("First", firstName); dealerTrackData.put("Present Address", address0); dealerTrackData.put("Zip Code", zipCode); dealerTrackData.put("City", city); dealerTrackData.put("State", state); } dealerTrackData.put("addressLine", address0 + ", " + city + ", " + state + " " + zipCode); boolean cosigner = false; // Co-Signer Name and Address (if applicable) try { String coAppFirstName = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_co_first_name').value"); String coAppLastName = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_co_last_name').value"); String coAppFullName = coAppFirstName + ' ' + coAppLastName; // Store Co-App Full Name (for TX Contract) dealerTrackData.put("coAppFullName", coAppFullName); String coAppAddress0 = (String) jse .executeScript("return ((document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_co_street_num').value).concat(' '))." + "concat(document.getElementById('iFrm').contentWindow.document.body.childNodes[2].contentDocument." + "getElementById('app_co_street_name').value)"); String coAppAptNum = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_co_apt_num').value"); if (!coAppAptNum.equals("")) coAppAddress0 = coAppAddress0 + " " + coAppAptNum; String coAppCity = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_co_city').value"); String coAppState = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_co_state').value"); String coAppZipCode = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_co_zip_code').value"); dealerTrackData.put("Text6", coAppFullName + "\n" + coAppAddress0 + "\n" + coAppCity + ", " + coAppState + " " + coAppZipCode); if (args[1].equals("Ally") || dealerTrackData.get("buyerState").equals("TX")) { dealerTrackData.put("First2", coAppFirstName); dealerTrackData.put("Last Name (or trade nameof business)2", coAppLastName); dealerTrackData.put("Present Address2", coAppAddress0); dealerTrackData.put("Zip Code2", coAppZipCode); dealerTrackData.put("City2", coAppCity); dealerTrackData.put("State2", coAppState); } cosigner = true; } catch (WebDriverException e) { dealerTrackData.put("cosignerNullField", "N/A"); } // Car Year String carYear = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementById('app_auto_yearList').value"); dealerTrackData.put("Text9", carYear); // Car Make and Model String carMake = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_auto_makeList').value"); String carModel = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_auto_modelList').value"); dealerTrackData.put("Text10", carMake + ' ' + carModel); dealerTrackData.put("Make", carMake); dealerTrackData.put("Model", carModel); // Style/Trim String carStyleTrim = (String) jse.executeScript("return document.getElementById('iFrm').contentWindow." + "document.body.childNodes[2].contentDocument.getElementById('app_auto_trimList').value"); dealerTrackData.put("StylefTrim", carStyleTrim); // VIN String vin = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementById('app_vin_num').value"); dealerTrackData.put("Text12", vin); // Amount Financed if (args[1].equals("Chase")) recalculateChaseStructure(jse); String amountFinanced = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementsByName('app_est_amt_financed')[0].value"); double amountFinancedDouble = Double.parseDouble(amountFinanced); String amountFinancedFormatted = moneyFormatter.format(amountFinancedDouble); dealerTrackData.put("Text17", amountFinancedFormatted); // Term String loanTerm = (jse .executeScript("return (document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementsByName('app_terms')[0].value - 1)") .toString()); dealerTrackData.put("Number Payments 4", dealerTrackData.get("buyerState").equals("CA") ? loanTerm : Integer.toString(Integer.parseInt(loanTerm) + 1)); // Meaty Loan Calculations double aprDouble = (Double.parseDouble((String) dealerTrackData.get("Text15")) / (Double) 100.); int loanTermInt = Integer.parseInt(loanTerm) + 1; double monthlyPayment = Double.parseDouble(moneyFormatter.format(amountFinancedDouble * (aprDouble / 12.) / (1. - Math.pow(1. + aprDouble / 12., -loanTermInt)))); String roundMonthlyPayment = moneyFormatter.format(monthlyPayment); double totalOfPayments = monthlyPayment * loanTermInt; String roundTotalOfPayments = moneyFormatter.format(totalOfPayments); // Total of Payments dealerTrackData.put("Text18", roundTotalOfPayments); // Finance Charge (take care of down payment later) dealerTrackData.put("Text16", moneyFormatter.format(totalOfPayments - amountFinancedDouble)); // Monthly Payments dealerTrackData.put("Text26", roundMonthlyPayment); dealerTrackData.put("Text31", roundMonthlyPayment); // First and Last Payment Date DateTimeFormatter ddFormat = DateTimeFormatter.ofPattern("M/d/yyyy"); LocalDate dd = LocalDate.parse(args[2], ddFormat); int plusDays = (args[1].equals("Chase")) ? 45 : 30; LocalDate firstPayment = dd.plusDays(plusDays); LocalDate lastPayment = firstPayment.plusMonths(loanTermInt - 1); String firstPaymentFormatted = firstPayment.format(ddFormat); String lastPaymentFormatted = lastPayment.format(ddFormat); dealerTrackData.put("Text27", firstPaymentFormatted); dealerTrackData.put("Text32", lastPaymentFormatted); // Car Base Price String carBasePrice = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementsByName('app_price')[0].value"); double carBasePriceDouble = Double.parseDouble(carBasePrice); String carBasePriceFormatted = moneyFormatter.format(carBasePriceDouble); dealerTrackData.put("Text33", carBasePriceFormatted); dealerTrackData.put("Text34", carBasePriceFormatted); // Sales Tax String carTaxes = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementsByName('app_sales_tax')[0].value"); double carTaxesDouble = Double.parseDouble(carTaxes); String carTaxesFormatted = moneyFormatter.format(carTaxesDouble); dealerTrackData.put("Text49", carTaxesFormatted); // Extended Peace of Mind String serviceContract = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementsByName('app_warranty')[0].value"); Double serviceContractDouble = 0.; if (!serviceContract.equals("")) { serviceContractDouble = Double.parseDouble(serviceContract); dealerTrackData.put("Text51", moneyFormatter.format(serviceContractDouble)); // For California Contract dealerTrackData.put("Text94", "Beepi Peace of Mind"); dealerTrackData.put("7/13_1LCompany", "Beepi Peace of Mind"); // For Arizona or Texas Contract dealerTrackData.put("Beepi", "Beepi"); dealerTrackData.put("na5", "Extended Peace of Mind"); } // Documentary Service Fees String documentFee = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementsByName('app_other_finance_fees')[0].value"); Double documentFeeDouble = 0.; if (!documentFee.equals("")) { documentFeeDouble = Double.parseDouble(documentFee); dealerTrackData.put("Text42", moneyFormatter.format(documentFeeDouble)); } // Registration Fees String regFees = (String) jse .executeScript("return document.getElementById('iFrm').contentWindow.document.body." + "childNodes[2].contentDocument.getElementsByName('app_ttl')[0].value"); double regFeesDouble = Double.parseDouble(regFees); String regFeesFormatted = moneyFormatter.format(regFeesDouble); dealerTrackData.put("Text62", regFeesFormatted); dealerTrackData.put("Text65", regFeesFormatted); // Calculate Contract Based on State switch ((String) dealerTrackData.get("buyerState")) { case "CA": californiaContract(args, jse, dealerTrackData, carBasePriceDouble, carTaxesDouble, serviceContractDouble, regFeesDouble, documentFeeDouble, totalOfPayments); break; case "AZ": case "TX": case "WA": arizonaTexasWashingtonContract(args, jse, dealerTrackData, carBasePriceDouble, carTaxesDouble, serviceContractDouble, regFeesDouble, documentFeeDouble, totalOfPayments); break; } // Amount Financed dealerTrackData.put("Text77", amountFinancedFormatted); // Delivery Date (Signatures) String ddFormatted = dd.format(ddFormat); dealerTrackData.put("Text159", ddFormatted); dealerTrackData.put("Text165", ddFormatted); if (cosigner) dealerTrackData.put("Text160", ddFormatted); // Populate Credit Applications if (args[1].equals("Ally")) getAllyCreditInfo(jse, dealerTrackData, cosigner); else getChaseCreditInfo(jse, dealerTrackData, driver); } catch (Exception e) { e.printStackTrace(); } driver.quit(); String contractDir = "DO NOT EDIT - AutoFill Contracts/"; try { if (args[1].equals("Ally")) { outputDir = makeOutputDir(dealerTrackData); fillPdf(dealerTrackData, contractDir + "Blank Ally Credit Application.pdf", outputDir, "Ally Credit Application"); fillPdf(dealerTrackData, contractDir + "Blank Ally Odometer Disclosure.pdf", outputDir, "Ally Odometer Disclosure"); fillPdf(dealerTrackData, contractDir + "Blank Ally Insurance Form.pdf", outputDir, "Ally Insurance Form"); fillPdf(dealerTrackData, contractDir + "Ally Title Guarantee.pdf", outputDir, "Guarantee of Title"); } else { fillPdf(dealerTrackData, contractDir + "Blank Agreement to Furnish Insurance.pdf", outputDir, "Chase Insurance Form"); fillPdf(dealerTrackData, contractDir + "Chase Title Guarantee.pdf", outputDir, "Guarantee of Title"); } switch ((String) dealerTrackData.get("buyerState")) { case "CA": fillPdf(dealerTrackData, contractDir + "Blank Purchase Contract-N-A'd out.pdf", outputDir, "Purchase Contract"); break; case "AZ": fillPdf(dealerTrackData, contractDir + "Blank AZ Purchase Contract-N-A'd out.pdf", outputDir, "Purchase Contract"); break; case "TX": fillPdf(dealerTrackData, contractDir + "Blank TX Purchase Contract-N-A'd out.pdf", outputDir, "Purchase Contract"); break; case "WA": fillPdf(dealerTrackData, contractDir + "Blank WA Purchase Contract-N-A'd out.pdf", outputDir, "Purchase Contract"); break; } } catch (NullPointerException e) { e.printStackTrace(); } }
From source file:Filter2002Test.java
@Test public void test_1() { WebElement filter = driver.findElement(By.id("filter")); filter.sendKeys("2002"); List<WebElement> tableRows = driver.findElements(By.tagName("tr")); // asserting that if content is filtered the amount of table rows must // be three including the table header's row. assertThat(tableRows.size(), is(3)); }
From source file:Filter2002Test.java
@Test public void test_2() { WebElement filter = driver.findElement(By.id("filter")); filter.sendKeys(Keys.BACK_SPACE); WebElement table = driver.findElement(By.id("tbodycars")); List<WebElement> tableRows = table.findElements(By.tagName("tr")); // There should be five rows of data. assertThat(tableRows.size(), is(5)); }
From source file:ToTrainingFolder.java
public static void main(String[] args) throws IOException { System.setProperty("webdriver.ie.driver", "C:\\Users\\Colin Cook\\Desktop\\Opstar Training Folder\\IEDriverServer.exe"); WebDriver driver = new InternetExplorerDriver(); driver.get("http://10.0.1.53/opstar_test/"); out.println("Launching Internet Explorer browser.."); driver.manage().window().maximize(); try {//from ww w . j a v a 2s .c o m Thread.sleep(1000); // pauses for 1 second } catch (InterruptedException e) { e.printStackTrace(); } out.println("The title of the page being tested is: " + driver.getTitle()); WebElement acknowledge = driver .findElement(By.xpath("html/body/div[5]/div[1]/div[2]/div[2]/div[1]/div/div[2]/center/a")); acknowledge.click(); //first popup when you go on site try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement applications = driver.findElement(By.xpath("html/body/div[3]/div[2]/div/div[1]/ul[2]/li[7]/a")); //driver.findElement(By.linkText("Training Folder")); System.out.println(applications.getText()); applications.click(); WebElement toTools = driver .findElement(By.xpath("html/body/div[3]/div[2]/div/div[1]/ul[2]/li[7]/ul/li[2]/a")); toTools.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement traingFolder = driver .findElement(By.xpath("html/body/div[3]/div[2]/div/div[1]/ul[2]/li[7]/ul/li[2]/ul/li/a")); traingFolder.click(); System.out.println("The Training Folder has been selected"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement closeBox = driver.findElement(By.id("cboxClose")); closeBox.click(); //clicks second popup acknolwedge box try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement textBox = driver.findElement(By .xpath("html/body/div[3]/div[4]/div[2]/div/div[1]/div/div[2]/div/form/div/div/span/span[1]/span")); textBox.click(); textBox.sendKeys("ken"); textBox.sendKeys(Keys.ENTER); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } /*************** THIS IS WHERE THE QUALIFICATIONS FOLDER STARTS ******************/ WebElement image1 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[2]/div[3]/div[3]/div[1]/div[1]/span/a/img")); image1.click(); image1.sendKeys(Keys.ESCAPE); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement table1 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[2]/div[3]/div[3]/div[1]/div[2]/input")); table1.clear(); table1.sendKeys("Testing table 1, Opstar Test"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement date1 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[2]/div[3]/div[3]/div[1]/div[3]/input")); date1.click(); date1.clear(); date1.sendKeys("12/25/2016"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } // WebElement save = driver.findElement(By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[2]/div[3]/div[3]/div[1]/div[5]/span[1]/i")); //save.click(); WebElement image2 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[2]/div[3]/div[3]/div[3]/div[1]/span/a/img")); image2.click(); image2.sendKeys(Keys.ESCAPE); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement title2 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[2]/div[3]/div[3]/div[3]/div[2]/input")); title2.clear(); title2.sendKeys("Testing table 2, Opstar test 2"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement date2 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[2]/div[3]/div[3]/div[3]/div[3]/input")); date2.click(); date2.clear(); date2.sendKeys("01/01/2017"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } // WebElement save2 = driver.findElement(By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[2]/div[3]/div[3]/div[3]/div[5]/span[1]/i")); //save2.click(); WebElement closeQualifications = driver .findElement(By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[1]/div/div/div[1]/div/a[2]")); closeQualifications.click(); System.out.println("The Qualifications folder has been tested"); /*************** THIS IS WHERE THE DESIGNATIONS FOLDER STARTS ******************/ WebElement Designations = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[1]/div/div[2]/table/tbody/tr/td[1]/span/a/img")); Designations.click(); Designations.sendKeys(Keys.ESCAPE); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement DesignationsTitle = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[1]/div/div[2]/table/tbody/tr/td[2]/input")); DesignationsTitle.clear(); DesignationsTitle.sendKeys("Testing the Desiganations title box, Opstar Test"); WebElement DesignationsIssue = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[1]/div/div[2]/table/tbody/tr/td[3]/input")); DesignationsIssue.clear(); DesignationsIssue.sendKeys("03/24/2017"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } // WebElement saveDesignations = driver.findElement(By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[1]/div/div[2]/table/tbody/tr/td[5]/span[1]/i")); //saveDesignations.click(); WebElement closeDesignations = driver .findElement(By.xpath(".//*[@id='student_folder_wrapper']/div[2]/div[1]/div/div[1]/div/a[2]")); closeDesignations.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("The Designations box has been tested"); /*************** THIS IS WHERE THE WAIVERS FOLDER STARTS ******************/ WebElement waivers = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[2]/div/div[1]/div/a[2]")); waivers.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement waiversFile = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[2]/div/div[2]/table/tbody/tr/td[1]/span/a/img")); waiversFile.click(); waiversFile.sendKeys(Keys.ESCAPE); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement waiversTitle = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[2]/div/div[2]/table/tbody/tr/td[2]/input")); waiversTitle.clear(); waiversTitle.sendKeys("Testing the Waivers folder, Opstar test"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement issueDateWaivers = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[2]/div/div[2]/table/tbody/tr/td[3]/input")); issueDateWaivers.clear(); issueDateWaivers.sendKeys("01/16/2016"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } //WebElement saveWaivers = driver.findElement(By.xpath(".//*[@id='student_folder_wrapper']/div[2]/div[2]/div/div[2]/table/tbody/tr/td[5]/span[1]/i")); //saveWaivers.click(); WebElement closeWaivers = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[2]/div/div[1]/div/a[2]")); closeWaivers.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("The waivers folder has been tested"); /*************** THIS IS WHERE THE PROFESSIONAL LICENSES FOLDER STARTS ******************/ WebElement proLicensesCert = driver .findElement(By.xpath(".//*[@id='student_folder_wrapper']/div[2]/div[3]/div/div[1]/div/a[2]")); proLicensesCert.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement imagePro = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/table/tbody/tr/td[1]/span/a/img")); imagePro.click(); imagePro.sendKeys(Keys.ESCAPE); WebElement proTitle = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/table/tbody/tr/td[2]/input")); proTitle.clear(); proTitle.sendKeys("OpSTAR Automation testing this title box"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement proIssueDate = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/table/tbody/tr/td[3]/input")); proIssueDate.clear(); proIssueDate.sendKeys("05/04/2017"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement proClose = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[3]/div/div[1]/div/a[2]")); proClose.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("The professional Licenses, Certificates, Medical folder has been tested"); /*************** THIS IS WHERE THE FIRSTAID FOLDER STARTS ******************/ WebElement firstAid = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[4]/div/div[1]/div/a[2]")); firstAid.click(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement firstAidImage = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[4]/div/div[2]/table/tbody/tr/td[1]/span/a/img")); firstAidImage.click(); firstAidImage.sendKeys(Keys.ESCAPE); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement firstAidTitle = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[4]/div/div[2]/table/tbody/tr/td[2]/input")); firstAidTitle.clear(); firstAidTitle.sendKeys("KeyBridge automation testing using Selenium"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement firstAidDate = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[4]/div/div[2]/table/tbody/tr/td[3]/input")); firstAidDate.clear(); firstAidDate.sendKeys("02/02/2017"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement closeFirstAid = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[4]/div/div[1]/div/a[2]")); closeFirstAid.click(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("The First Aid folder has been tested"); /*************** THIS IS WHERE THE STAR FOLDER STARTS ******************/ WebElement starOpen = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[5]/div/div[1]/div/a[2]")); starOpen.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement starImage1 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[5]/div/div[2]/table/tbody/tr[1]/td[1]/span/a/img")); starImage1.click(); starImage1.sendKeys(Keys.ESCAPE); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement starTitle1 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[5]/div/div[2]/table/tbody/tr[1]/td[2]/input")); starTitle1.clear(); starTitle1.sendKeys("KeyBridge OpSTAR automation testing"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement starIssueDate1 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[5]/div/div[2]/table/tbody/tr[1]/td[3]/input")); starIssueDate1.clear(); starIssueDate1.sendKeys("03/17/2017"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement starTitle2 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[5]/div/div[2]/table/tbody/tr[2]/td[2]/input")); starTitle2.clear(); starTitle2.sendKeys("CPB Automation Testing"); // WebElement starIssueDate2 = driver.findElement(By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[5]/div/div[2]/table/tbody/tr[2]/td[3]/input")); // starIssueDate2.click(); WebElement closeStarFolder = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[5]/div/div[1]/div/a[2]")); closeStarFolder.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("The Star Folder has been tested"); /*************** THIS IS WHERE THE TRAINING COURSES AND TESTS FOLDER STARTS ******************/ WebElement openCourseAndTests = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[6]/div/div[1]/div/a[2]")); openCourseAndTests.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement lastFive = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[6]/div/div[1]/h4/span[2]")); lastFive.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement showAll = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[6]/div/div[1]/h4/span[3]")); showAll.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement closeTrainingCourse = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[6]/div/div[1]/div/a[2]")); closeTrainingCourse.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("The Training Courses and Tests folder has been tested"); /*************** THIS IS WHERE THE PROFESSIONAL DEVELOPMENT FOLDER STARTS ******************/ WebElement proDevelopment = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[7]/div/div[1]/div/a[2]")); proDevelopment.click(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement proImage = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[7]/div/div[2]/table/tbody/tr/td[1]/span/a/img")); proImage.click(); proImage.sendKeys(Keys.ESCAPE); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement proTitle2 = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[7]/div/div[2]/table/tbody/tr/td[2]/input")); proTitle2.clear(); proTitle2.sendKeys("Testing the PRO Development box"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement proDevelopmentDate = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[7]/div/div[2]/table/tbody/tr/td[3]/input")); proDevelopmentDate.clear(); proDevelopmentDate.sendKeys("03/24/2017"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement closeProDevelopment = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[7]/div/div[1]/div/a[2]")); closeProDevelopment.click(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("The Professional Development / Individual Development Plan Folder has been tested"); /*************** THIS IS WHERE THE FLETC CERTIFICATES FOLDER STARTS ******************/ WebElement fletcOpen = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[8]/div/div[1]/div/a[2]")); fletcOpen.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement fletcImage = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[8]/div/div[2]/table/tbody/tr/td[1]/span/a/img")); fletcImage.click(); fletcImage.sendKeys(Keys.ESCAPE); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement fletcTitle = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[8]/div/div[2]/table/tbody/tr/td[2]/input")); fletcTitle.clear(); fletcTitle.sendKeys("Testing the FLETC Certificates folder"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement fletcDate = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[8]/div/div[2]/table/tbody/tr/td[3]/input")); fletcDate.clear(); fletcDate.sendKeys("03/24/2017"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement closeFLETC = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[8]/div/div[1]/div/a[2]")); closeFLETC.click(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("The FLETC Certificates Folder has been tested"); /*************** THIS IS WHERE THE MISCELLANEOUS CERTIFICATES FOLDER STARTS ******************/ WebElement openMisc = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[9]/div/div[1]/div/a[2]")); openMisc.click(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement miscImage = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[9]/div/div[2]/table/tbody/tr/td[1]/span/a/img")); miscImage.click(); miscImage.sendKeys(Keys.ESCAPE); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement miscTitle = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[9]/div/div[2]/table/tbody/tr/td[2]/input")); miscTitle.clear(); miscTitle.sendKeys("Testing the the Misc box"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement miscDate = driver.findElement(By.xpath( "html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[9]/div/div[2]/table/tbody/tr/td[3]/input")); miscDate.clear(); miscDate.sendKeys("12/25/2016"); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement closeMisc = driver.findElement( By.xpath("html/body/div[3]/div[4]/div[2]/div/div[2]/div[2]/div[9]/div/div[1]/div/a[2]")); closeMisc.click(); System.out.println("The Miscellaneous folder has been tested"); System.out.println("The Training Folder automation test has successfully passed!"); }
From source file:StoryKeyboardShortcutTests.java
@Test public void storyFirstTest() throws InterruptedException { //1. Go to story site driver.get(/*from w ww . ja va 2 s.c o m*/ "http://tanveer-pc:9724/web/story/story.html?debug&storyhub=tanveer-pc&gh=Guest/@tanveer-pc&pilot=tanveer-pc&preview=tanveer-pc&mediaservice=tanveer-pc"); //driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); WebDriverWait wait = new WebDriverWait(driver, 15); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector( "img[src='http://tanveer-pc:9724/web/story/story/sc/skins/vizrt/images/Editor/Close.png']"))); //2. Close the license popup WebElement okButton = driver.findElement(By.cssSelector( "img[src='http://tanveer-pc:9724/web/story/story/sc/skins/vizrt/images/Editor/Close.png']")); okButton.click(); //Click on Media tab WebElement uploadButton = driver.findElement( By.xpath("html/body/div[4]/div/div[1]/div/div[1]/div/div[2]/div[1]/div[1]/div/table/tbody/tr/td")); uploadButton.click(); //Click on video tab WebElement videoTab = driver.findElement(By.xpath( "html/body/div[4]/div/div[1]/div/div[1]/div/div[2]/div[3]/div/div/div/div/div[2]/div[1]/div/div/div/table[1]/tbody[2]/tr[1]/td[1]/div/div/div[2]")); videoTab.click(); WebElement searchText = driver.findElement(By.id("isc_30")); searchText.sendKeys("SSS_2477_01.mov"); Thread.sleep(5000); WebElement selectVideo = driver.findElement(By.xpath( "html/body/div[4]/div/div[1]/div/div[1]/div/div[2]/div[3]/div/div/div/div/div[2]/div[2]/div[3]/div[1]/div[3]")); selectVideo.click(); WebElement selectVideo1 = driver.findElement(By.xpath( "html/body/div[4]/div/div[1]/div/div[1]/div/div[2]/div[3]/div/div/div/div/div[2]/div[2]/div[3]/div[1]/div[3]")); selectVideo1.click(); Thread.sleep(2000); WebElement timeLine = driver.findElement(By.cssSelector("svg[id=multimedia_ClearInOut]")); timeLine.click(); Thread.sleep(2000); int xp1 = 0; WebElement testtimecode1 = driver.findElement(By.xpath("//*[contains(text(),'00:0" + xp1 + ":')]")); final String starttime = testtimecode1.getText(); Actions action = new Actions(driver); action.sendKeys(Keys.SPACE).build().perform(); System.out.println(testtimecode1.getText()); int ourtime = 9000; Thread.sleep(ourtime); int xp = (ourtime - 1000) / 1000; action.sendKeys(Keys.SPACE).build().perform(); Thread.sleep(2000); timeLine.click(); Thread.sleep(2000); WebElement testtimecode = driver.findElement(By.xpath("//*[contains(text(),'00:0" + xp + ":')]")); System.out.println(testtimecode.getText()); System.out.println(testtimecode1.getText()); Assert.assertNotEquals(testtimecode.getText(), starttime); //Assert.assertNotEquals("111", "1"); }
From source file:StoryKeyboardShortcutTests.java
@Test public void storyKeyboardMute() throws InterruptedException { //1. Go to story site driver.get(/*w w w . j a v a 2 s .c om*/ "http://tanveer-pc:9724/web/story/story.html?debug&storyhub=tanveer-pc&gh=Guest/@tanveer-pc&pilot=tanveer-pc&preview=tanveer-pc&mediaservice=tanveer-pc"); //driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); WebDriverWait wait = new WebDriverWait(driver, 15); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector( "img[src='http://tanveer-pc:9724/web/story/story/sc/skins/vizrt/images/Editor/Close.png']"))); //2. Close the license popup WebElement okButton = driver.findElement(By.cssSelector( "img[src='http://tanveer-pc:9724/web/story/story/sc/skins/vizrt/images/Editor/Close.png']")); okButton.click(); //Click on Media tab WebElement uploadButton = driver.findElement( By.xpath("html/body/div[4]/div/div[1]/div/div[1]/div/div[2]/div[1]/div[1]/div/table/tbody/tr/td")); uploadButton.click(); //Click on video tab WebElement videoTab = driver.findElement(By.xpath( "html/body/div[4]/div/div[1]/div/div[1]/div/div[2]/div[3]/div/div/div/div/div[2]/div[1]/div/div/div/table[1]/tbody[2]/tr[1]/td[1]/div/div/div[2]")); videoTab.click(); WebElement searchText = driver.findElement(By.id("isc_30")); searchText.sendKeys("SSS_2477_01.mov"); Thread.sleep(5000); WebElement selectVideo = driver.findElement(By.xpath( "html/body/div[4]/div/div[1]/div/div[1]/div/div[2]/div[3]/div/div/div/div/div[2]/div[2]/div[3]/div[1]/div[3]")); selectVideo.click(); WebElement selectVideo1 = driver.findElement(By.xpath( "html/body/div[4]/div/div[1]/div/div[1]/div/div[2]/div[3]/div/div/div/div/div[2]/div[2]/div[3]/div[1]/div[3]")); selectVideo1.click(); /* Thread.sleep(2000) ; WebElement timeLine = driver.findElement(By.cssSelector("svg[id=multimedia_ClearInOut]")); timeLine.click(); Thread.sleep(2000); int xp1=0; WebElement testtimecode1 = driver.findElement(By.xpath("//*[contains(text(),'00:0"+xp1+":')]")); final String starttime = testtimecode1.getText(); Actions action = new Actions(driver); action.sendKeys(Keys.SPACE).build().perform(); System.out.println(testtimecode1.getText()); int ourtime = 9000; Thread.sleep(ourtime); int xp = (ourtime-1000)/1000; action.sendKeys(Keys.SPACE).build().perform(); Thread.sleep(2000); timeLine.click(); Thread.sleep(2000); WebElement testtimecode = driver.findElement(By.xpath("//*[contains(text(),'00:0"+xp+":')]")); System.out.println(testtimecode.getText()); System.out.println(testtimecode1.getText()); Assert.assertNotEquals(testtimecode.getText(), starttime); //Assert.assertNotEquals("111", "1"); */ }
From source file:seleniumTester.java
@Test public void test2() throws Exception { WebElement element = driver.findElement(By.id("filter")); element.sendKeys("1999"); (new WebDriverWait(driver, WAIT_MAX)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { WebElement e = d.findElement(By.tagName("tbody")); List<WebElement> rows = e.findElements(By.tagName("tr")); return rows.size() == 2; }/*from w ww . j a v a2s. c o m*/ }); }
From source file:seleniumTester.java
@Test public void test3() { WebElement element = driver.findElement(By.id("filter")); element.sendKeys(Keys.CONTROL + "a"); element.sendKeys(Keys.DELETE);/*from w w w . j ava2 s . c o m*/ (new WebDriverWait(driver, WAIT_MAX)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { WebElement e = d.findElement(By.tagName("tbody")); List<WebElement> rows = e.findElements(By.tagName("tr")); Assert.assertThat(rows.size(), is(5)); return rows.size() == 5; } }); }
From source file:seleniumTester.java
@Test public void test_5() { List<WebElement> tds = driver.findElement(By.id("tbodycars")).findElements(By.cssSelector("tr")).get(0) .findElements(By.tagName("td")); tds.get(7).findElements(By.tagName("a")).get(0).click(); WebElement element = driver.findElement(By.id("description")); element.sendKeys(Keys.CONTROL + "a"); element.sendKeys(Keys.DELETE);//from w w w . java 2 s. co m element.sendKeys("Cool car"); driver.findElement(By.id("save")).click(); (new WebDriverWait(driver, WAIT_MAX)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { WebElement e = d.findElement(By.tagName("tbody")); List<WebElement> rows = e.findElements(By.tagName("tr")); String result = null; for (int i = 0; i < rows.size(); i++) { if (rows.get(i).findElements(By.tagName("td")).get(0).getText().equalsIgnoreCase("938")) { result = rows.get(i).findElements(By.tagName("td")).get(5).getText(); break; } } assertThat(result, is("Cool car")); return true; } }); }
From source file:LoginScreenGrapheneTest.java
@Test @RunAsClient/*ww w. j a v a 2 s . c om*/ public void ShouldBePosibleToSearchTestowkaAtGoogle() throws InterruptedException { browser.get("http://google.pl"); WebElement searchField = browser.findElement(By.name("q")); searchField.sendKeys("testowka.pl"); WebElement searchButton = browser.findElement(By.id("sblsbb")); searchButton.click(); for (int second = 0;; second++) { if (second >= 60) fail("timeout"); try { if (browser.findElement(By.linkText("Testowka.pl")).isDisplayed()) { break; } } catch (Exception e) { } Thread.sleep(1000); } WebElement linkToTestowka = browser.findElement(By.linkText("Testowka.pl")); linkToTestowka.click(); }