@Test
  public void exportTimesheetrough() throws IOException, InterruptedException {
    initialize();
    openBrowser();
    driver.get(CONFIG.getProperty("testSiteName"));
    login_Valid();

    // moving on to payslip for generating new payslip
    getObject("payBillX").click();
    getObject("timeSheetLinkX").click();
    getObject("exportTimesheetsX").click();

    // getObjectById("exportFormatTimesheetsId").sendKeys("");
    // for Export Timesheets Date Starting
    getObjectById("exportExportDateStartingId").click();
    Select monthForExportTimesheetstart = new Select(getObject("exportDateStartingMonthX"));
    monthForExportTimesheetstart.selectByVisibleText("Sep");
    Select yearForExportTimesheetstart = new Select(getObject("exportDateStartingYearX"));
    yearForExportTimesheetstart.selectByValue("2015");
    getObject("exportDateStartingSep3X").click();

    // For Timesheets Export Date Ending
    getObjectById("exportDateEndingId").click();
    Select monthForExportTimesheetend = new Select(getObject("exportDateEndingMonthX"));
    monthForExportTimesheetend.selectByVisibleText("Sep");
    Select yearForExportTimesheetend = new Select(getObject("exportDateEndingYearX"));
    yearForExportTimesheetend.selectByValue("2015");
    getObjectById("exportCandidateNameId").sendKeys("");
    getObject("exportDateStartingSep3X").click();
  }
  public void UserAccount(
      String fname,
      String lname,
      String email,
      String pass,
      String day,
      String month,
      String year) {
    driver.findElement(firstName).sendKeys(fname);
    driver.findElement(lastName).sendKeys(lname);
    driver.findElement(userEmail).sendKeys(email);
    driver.findElement(userPass).sendKeys(pass);
    driver.findElement(birthDay).click();
    Select dropdown = new Select(driver.findElement(birthDay));
    dropdown.selectByValue(day);
    driver.findElement(birthMonth).click();
    Select dropdown1 = new Select(driver.findElement(birthMonth));
    dropdown1.selectByValue(month);
    driver.findElement(birthYear).click();
    Select dropdown2 = new Select(driver.findElement(birthYear));
    dropdown2.selectByValue(year);

    driver.findElement(registerButton).click();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  }
예제 #3
0
  public static void main(String[] args) {
    // TODO Auto-generated method stu2) Close all the frames other than center -

    System.setProperty(
        "webdriver.chrome.driver",
        "C:\\Users\\Admin\\MyWorkspace\\SeleniumWebDriver\\chromedriver_win32\\chromedriver.exe");
    ChromeDriver driver = new ChromeDriver();
    driver.get("http://www.crystalcruises.com");
    String parentWindowHandle = driver.getWindowHandle();
    driver.findElementByLinkText("GUEST CHECK-IN").click();
    Set<String> allWindowHandles = driver.getWindowHandles();
    for (String windowHandle : allWindowHandles) {
      driver.switchTo().window(windowHandle);
    }
    driver.findElementByLinkText("click here").click();

    Set<String> allWndHandles = driver.getWindowHandles();
    for (String wndHandle : allWndHandles) {
      driver.switchTo().window(wndHandle);
    }
    Select dropdown = new Select(driver.findElementByClassName("goog-te-combo"));
    dropdown.selectByValue("ta");

    // Run configuration ->Common tab -> Other radio button -> UTF 8 -> Click Apply -> Click Run
    String text = driver.findElementByXPath("//*[@id='mainBody']/div[1]/div[2]").getText();
    System.out.println(text);

    // not getting tamil text?
  }
예제 #4
0
 /**
  * Select theme and apply selected one
  *
  * @param theme ThemeType
  * @return {@link AdminConsolePage}
  */
 public HtmlPage selectTheme(ThemeType theme) throws TimeoutException, InterruptedException {
   checkNotNull(theme.text);
   Select themeType = new Select(driver.findElement(THEME_MENU_SELECT));
   themeType.selectByValue(theme.text);
   clickApplyButton();
   return getCurrentPage();
 }
예제 #5
0
 public WebElementFacade selectByValue(String value) {
   enableHighlightingIfRequired();
   waitUntilElementAvailable();
   Select select = new Select(webElement);
   select.selectByValue(value);
   notifyScreenChange();
   return this;
 }
예제 #6
0
 @Test
 public void shouldAllowOptionsToBeSelectedByReturnedValue() {
   WebElement selectElement = driver.findElement(By.name("select_empty_multiple"));
   Select select = new Select(selectElement);
   select.selectByValue("select_2");
   WebElement firstSelected = select.getFirstSelectedOption();
   assertEquals("select_2", firstSelected.getText());
 }
예제 #7
0
 /**
  * @param locator Path to drop-down selector
  * @param value Desired value to be selected
  */
 protected void selectByValue(String locator, String value) {
   try {
     Select select = new Select(driver.findElement(getLocator(locator)));
     select.selectByValue(value);
     log.info("SELECTED BY VALUE : " + value + " from the: " + locator);
   } catch (Throwable e) {
     log.error("SELECT BY VALUE " + value + " was not located using the: " + locator);
     log.debug(e);
     captureScreen(getBrowserDetails(driver) + "/operationErrors/select/" + value, driver);
   }
 }
예제 #8
0
 public void setFieldValue(WebElement fieldElement, String value) {
   if ("checkbox".equals(fieldElement.getAttribute("type"))) {
     setCheckBox(fieldElement, value.equals("true"));
   } else if ("select".equals(fieldElement.getTagName())) {
     Select select = new Select(fieldElement);
     select.selectByValue(value);
   } else {
     fieldElement.clear();
     fieldElement.sendKeys(value);
   }
 }
예제 #9
0
  public void edit2(User user) {
    driver.get("https://www.academicwork.se/my-profile/cv");

    driver
        .findElement(By.xpath("//div[@id='cv-educations']/header/nav/a"))
        .click(); // "Lägg till" button for Utbildning
    WebElement schoolField = driver.findElement(By.id("School"));
    WebElement educationField = driver.findElement(By.id("Subject"));
    Select startYearField = new Select(driver.findElement(By.name("StartYear")));
    Select startMonthField = new Select(driver.findElement(By.name("StartMonth")));
    Select endYearField = new Select(driver.findElement(By.name("EndYear")));
    Select endMonthField = new Select(driver.findElement(By.name("EndMonth")));

    schoolField.sendKeys(user.school);
    educationField.sendKeys(user.education);
    startYearField.selectByValue(user.startYear);
    startMonthField.selectByValue(user.startMonth);
    endYearField.selectByValue(user.endYear);
    endMonthField.selectByValue(user.endMonth);
    schoolField.submit();
  }
예제 #10
0
파일: Bot.java 프로젝트: byde/dogame
  public void login() {
    // loginBtn
    WebElement btn_entrar = driver.findElement(By.id("loginBtn"));
    btn_entrar.click();
    try {
      (new WebDriverWait(driver, 30))
          .until(
              new ExpectedCondition<Boolean>() {

                public Boolean apply(WebDriver d) {
                  return d.findElement(By.id("loginSubmit")).isDisplayed();
                }
              });
    } catch (Exception e) {
      consola("Error: Login: "******"usernameLogin"));
    WebElement txt_pass = driver.findElement(By.id("passwordLogin"));
    WebElement btn_subm = driver.findElement(By.id("loginSubmit"));
    // WebElement opt_univ = new Select(driver.findElement(By.id("serverLogin")));
    Select opt_univ = new Select(driver.findElement(By.id("serverLogin")));

    // Enter something to search for passwordLogin
    // inputUsername.sendKeys("ulises");
    txt_user.sendKeys(Model.Config.getUsuario());
    txt_pass.sendKeys(Model.Config.getPass());
    opt_univ.selectByValue("uni106.ogame.com.es");

    // Now submit the form. WebDriver will Botfind the form for us from the element
    btn_subm.submit();

    // Check the title of the page
    // System.out.println("Page title is: " + driver.getTitle());

    // Google's search is rendered dynamically with JavaScript.
    // Wait for the page to load, timeout after 10 seconds
    try {
      (new WebDriverWait(driver, 30))
          .until(
              new ExpectedCondition<Boolean>() {

                public Boolean apply(WebDriver d) {
                  return d.getTitle().startsWith("Fornax");
                }
              });
      driver.switchTo().defaultContent();
      consola("Log: Login: Ingreso correctamente");
    } catch (Exception e) {
      consola("Error: Login: " + e.getMessage());
    }
  }
  public static void select(WebDriver webDriver, String selectLocator, String optionLocator) {

    WebElement webElement = getWebElement(webDriver, selectLocator);

    Select select = new Select(webElement);

    String label = optionLocator;

    if (optionLocator.startsWith("index=")) {
      String indexString = optionLocator.substring(6);

      int index = GetterUtil.getInteger(indexString);

      select.selectByIndex(index - 1);
    } else if (optionLocator.startsWith("value=")) {
      String value = optionLocator.substring(6);

      if (value.startsWith("regexp:")) {
        String regexp = value.substring(7);

        selectByRegexpValue(webDriver, selectLocator, regexp);
      } else {
        List<WebElement> optionWebElements = select.getOptions();

        for (WebElement optionWebElement : optionWebElements) {
          String optionWebElementValue = optionWebElement.getAttribute("value");

          if (optionWebElementValue.equals(value)) {
            label = optionWebElementValue;

            break;
          }
        }

        select.selectByValue(label);
      }
    } else {
      if (optionLocator.startsWith("label=")) {
        label = optionLocator.substring(6);
      }

      if (label.startsWith("regexp:")) {
        String regexp = label.substring(7);

        selectByRegexpText(webDriver, selectLocator, regexp);
      } else {
        select.selectByVisibleText(label);
      }
    }
  }
  public static void addSelection(WebDriver webDriver, String locator, String optionLocator) {

    Select select = new Select(getWebElement(webDriver, locator));

    if (optionLocator.startsWith("index=")) {
      select.selectByIndex(GetterUtil.getInteger(optionLocator.substring(6)));
    } else if (optionLocator.startsWith("label=")) {
      select.selectByVisibleText(optionLocator.substring(6));
    } else if (optionLocator.startsWith("value=")) {
      select.selectByValue(optionLocator.substring(6));
    } else {
      select.selectByVisibleText(optionLocator);
    }
  }
 @Test(priority = 3)
 public void TestingPreOrderShoesDropDownBoxes() throws Exception {
   WebDriverWait myWait = new WebDriverWait(drv, 10);
   drv.manage().window().maximize();
   drv.get("http://manheim-shoe-store-test.herokuapp.com/");
   myWait.until(ExpectedConditions.visibilityOfElementLocated(By.id("brand")));
   myWait.until(ExpectedConditions.elementToBeClickable(By.id("brand")));
   Select chooseBrand = new Select(drv.findElement(By.id("brand")));
   chooseBrand.selectByValue("Acorn");
   drv.findElement(By.id("search_button")).click();
   myWait.until(
       ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[class=\"title\"]")));
   myWait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("div[class=\"title\"]")));
   Assert.assertTrue(drv.getPageSource().contains("Acorn's Shoes"));
 }
예제 #14
0
  public RelationTabSubPage setRelationWithDocument(String documentName, String predicateUri) {

    org.junit.Assert.assertFalse(isObjectDocumentChecked());

    Select predicateSelect = new Select(predicate);
    predicateSelect.selectByValue(predicateUri);

    Select2WidgetElement documentSuggestionWidget =
        new Select2WidgetElement(driver, driver.findElement(By.xpath(SELECT2_DOCUMENT_XPATH)));

    documentSuggestionWidget.selectValue(documentName);

    Function<WebDriver, Boolean> isDocumentSelected =
        new Function<WebDriver, Boolean>() {
          @Override
          public Boolean apply(WebDriver driver) {
            WebElement selectedDocument = driver.findElement(By.id(OBJECT_DOCUMENT_UID_ID));
            String value = selectedDocument.getAttribute("value");
            boolean result = StringUtils.isNotBlank(value);
            if (!result) {
              log.debug("Waiting for select2 ajaxReRender");
            }
            return result;
          }
        };

    org.junit.Assert.assertTrue(isObjectDocumentChecked());

    Wait<WebDriver> wait =
        new FluentWait<WebDriver>(driver)
            .withTimeout(SELECT2_CHANGE_TIMEOUT, TimeUnit.SECONDS)
            .pollingEvery(100, TimeUnit.MILLISECONDS)
            .ignoring(StaleElementReferenceException.class);

    wait.until(isDocumentSelected);

    if (log.isDebugEnabled()) {
      WebElement selectedDocument = driver.findElement(By.id(OBJECT_DOCUMENT_UID_ID));
      log.debug("Submitting relation on document: " + selectedDocument.getAttribute("value"));
    }

    addButton.click();

    return asPage(RelationTabSubPage.class);
  }
예제 #15
0
  public void submitCustomerInfo(String registerCustomerType, String addressType) {
    selectAll(oFirstName_Input).sendKeys(Customer.FirstName);
    selectAll(oLastName_Input).sendKeys(Customer.LastName);
    selectAll(oContactNumber_Input).sendKeys(Customer.CellPhone);
    selectAll(oEmail_Input).sendKeys(Customer.Email);
    selectAll(oBirthday_Input).sendKeys(Customer.DOB);

    // Customer Type
    selectAll(oSsn_Input).sendKeys(Customer.getGeneratedSSN(registerCustomerType));

    // Address Type
    Select stateSelect = new Select(oResidentialState_DropDown);
    selectAll(oResidentialAddressPart1_Input).sendKeys(Customer.addressMap.get(addressType)[1]);
    selectAll(oResidentialAddressPart2_Input).sendKeys(Customer.addressMap.get(addressType)[2]);
    selectAll(oResidentialCity_Input).sendKeys(Customer.addressMap.get(addressType)[3]);
    stateSelect.selectByValue(Customer.addressMap.get(addressType)[4]);
    selectAll(oResidentialZipCode_Input).sendKeys(Customer.addressMap.get(addressType)[5]);
  }
예제 #16
0
  @Test
  public void one() {

    String pattern = "MM/dd/yyyy";
    Calendar cal = Calendar.getInstance();
    String startDateInString = new SimpleDateFormat(pattern).format(cal.getTime());

    login();
    gotoUnreturned();
    driver.findElement(By.cssSelector(".ace-icon.fa.fa-cog.fa-lg.ace-icon-custom")).click();
    try {
      Thread.sleep(2000);
      driver.findElement(By.id("calldataForm")).click();
      Thread.sleep(1000);
      Thread.sleep(1000);
      driver.findElement(By.id("advanceSearchCheckbox")).click();
      Thread.sleep(1000);
      driver.findElement(By.id("callerField")).sendKeys("Sai");
      Thread.sleep(1000);
      driver.findElement(By.id("calleeField")).sendKeys("Ram");
      Thread.sleep(1000);

      // Select dropdown = new Select(driver.findElement(By.id("form-field-select-1")));
      // dropdown.selectByValue("50");

      // driver.findElement(By.id("form-field-select-1")).sendKeys("50");
      Thread.sleep(5000);
      Select dropdown1 = new Select(driver.findElement(By.id("form-field-select-2")));
      dropdown1.selectByValue("US/Pacific");

      // driver.findElement(By.id("form-field-select-2")).sendKeys("US/Pacific");
      Thread.sleep(5000);
      driver.findElement(By.id("calldataFormSubmit")).click();
      Thread.sleep(5000);
      List<WebElement> list =
          driver.findElements(By.cssSelector("#callDataTable tr td:nth-child(4)"));
      // List<WebElement> list = driver.findElement(By.cssSelector("#callDataTable tr td"));
      for (WebElement el : list) {
        System.out.println(el.getText());
        Assert.assertTrue(el.getText().contains(startDateInString), "Faile");
      }
    } catch (Exception ex) {
    }
  }
  public int deleteAllPost() {
    String currentURL = driver.getCurrentUrl();
    System.out.println(currentURL);
    int position = currentURL.indexOf("/wp");
    currentURL = currentURL.substring(0, position);
    System.out.println(currentURL);
    currentURL = currentURL + "/wp-admin/edit.php";
    driver.navigate().to(currentURL);

    driver.findElement(By.id("cb-select-all-1")).click();
    Util.wait(2);

    Select dropdown = new Select(driver.findElement(By.id("bulk-action-selector-top")));
    dropdown.selectByValue("trash");
    Util.wait(3);
    System.out.println("DELETING...");
    driver.findElement(By.id("doaction")).click();

    return 1;
  }
예제 #18
0
  @Test
  public void assertThatWebviewSaysHello() throws Exception {
    WebElement button = driver().findElement(By.id("buttonStartWebview"));

    button.click();
    WebDriverWait wait = new WebDriverWait(driver(), 10);
    wait.until(ExpectedConditions.presenceOfElementLocated(By.linkText("Go to home screen")));
    driver().switchTo().window("WEBVIEW");

    WebElement inputField = driver().findElement(By.id("name_input"));
    Assert.assertNotNull(inputField);
    inputField.clear();
    inputField.sendKeys("Dominik");

    WebElement car = driver().findElement(By.name("car"));
    Select preferedCar = new Select(car);
    preferedCar.selectByValue("audi");
    inputField.submit();

    WaitingConditions.pageTitleToBe(driver(), "Hello: Dominik");
  }
  public static void enterEmail(
      String emailName,
      By forgetButton,
      By input,
      String emailAfterDog,
      By selectCombobox,
      By setButton) {
    getDriver().findElement(forgetButton).click();
    if (isElementPresent(input)) {
      getDriver().findElement(input).sendKeys(emailName);
      //            System.out.println("test pustoe pole vvoda, i v nego vveli znachenie");
    } else {
      getDriver().findElement(forgetButton).click();
      getDriver().findElement(input).sendKeys(emailName);
      //            System.out.println("test ni to ni drugoe, i v nego vveli znachenie");
    }

    Select selectBox = new Select(getDriver().findElement(selectCombobox));
    selectBox.selectByValue(emailAfterDog);
    getDriver().findElement(setButton).click();
  }
예제 #20
0
  // odi.623.Method for DNIS value search
  public void dnisfilter() {
    String dmName = "US_AIRWAYS";
    gotoreports(dmName);
    try {
      WebElement DNISvalue = driver.findElement(By.id("PARAM_DNIS"));
      Select select = new Select(DNISvalue);
      select.deselectAll();
      select.selectByValue("2404953077");
      driver
          .manage()
          .timeouts()
          .implicitlyWait(
              20,
              TimeUnit
                  .SECONDS); // submit should be clickable if delay is there in selecting the DNIS
      driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
      new WebDriverWait(driver, 10)
          .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("reportContent"));
      WebElement page =
          new WebDriverWait(driver, 10)
              .until(ExpectedConditions.visibilityOfElementLocated(By.id("CrystalViewer")));
      WebElement tag = page.findElement(By.xpath("//*[contains(text(),'2404953077')]"));
      if (tag != null) {
        System.out.println("DNIS:2404953077 filter is present");
        ReportFile.addTestCase(
            "ODI6.x-623:DNIS filter: selected DNIS filter should be shown in report result",
            "ODI6.x-623:DNIS filter: selected DNIS filter should be shown in report result => Pass");
      }

    } catch (Exception e) {
      System.out.print("trace: ");
      e.printStackTrace();
    }
    // driver.quit();
    ReportFile.WriteToFile();
    driver.switchTo().defaultContent();
  }
  @Parameters("browser")
  @Test
  public void RMO_TC5289_SingleDayModifyBAR_Test(@Optional("FF") String browserType) {
    try {
      this.gc.log.logSetup(this);
      this.gc.log.logInfo("/////Execution Started/////");
      gc.browser.BrowserCloseAllBrowser();

      gc.browser.BrowserGetBrowserType(browserType);
      gc.browser.BrowserGet(Global.BaseUrlRMO_QA);
      Thread.sleep(Global.Mid_Wait);

      gc.rmo.RMO_Login(Global.RMOLoginUsername, Global.RMOLoginPassword);
      Thread.sleep(Global.Mid_Wait);

      gc.rmo.RMOPricing_ClickProperty_QA(Global.RMO_PropertyName2);
      gc.browser.BrowserWaitForPageToLoad();
      gc.browser.BrowserClick("RMOPropertyPage_PropertiesLink_QA");
      gc.browser.BrowserWaitForPageToLoad();

      /* Select today's date from 30 Day Calendar */
      gc.browser.BrowserClick("RMOPropertyPricing_CurrentDay_Date");

      /*Select BAR value in Summary */

      Select select =
          new Select(gc.generic.findElement("RMOPropertyPricing_SingleDay_BARValue_DropDown"));
      select.selectByValue(Global.BarValue2);

      /*Click on submit button*/
      gc.browser.BrowserClick("RMOAddNewPricingPage_CreatePricingButton");

      gc.browser.BrowserWaitForElementPresent(
          "RMOPropertyPricing_Pricingconfirmationmessage_QA", 5);
      Thread.sleep(Global.Max_Wait);

      /*Verify Confirmation Msg*/
      Assert.assertTrue(
          gc.browser.BrowserGetTextFromElement("RMOPropertyPricing_Pricingconfirmationmessage_QA")
              .contains("You have successfully modified property pricing"),
          "Confirmation Message dilog is dispalyed");

      gc.browser.BrowserClick("RMOAddNewPricing_Alert_DoneBtn");

      Assert.assertTrue(
          gc.browser.BrowserGetTextFromElement("RMOPropertyPricing_SingleDay_BARValue_Today")
              .contains(Global.BarValue2),
          "message");

    } catch (IOException e) {
      this.gc.log.logException("Exception occured...", e);
      Assert.assertTrue(false, "Exception occured.... FAiling the script...!!");
    } catch (TimeoutException e) {
      this.gc.log.logException("Exception occured...", e);
      Assert.assertTrue(false, "Exception occured.... FAiling the script...!!");
    } catch (Exception e) {
      this.gc.log.logException("Exception occured...", e);
      Assert.assertTrue(false, "Exception occured.... Failing the script...!!");
    } finally {
      gc.generic.Env_Teardown();
    }
  }
예제 #22
0
 /**
  * Select By Value
  *
  * @param element
  * @param value
  */
 public void selectFromCombo_by_value(WebElement element, String value) {
   Select select = new Select(element);
   select.selectByValue(value);
 }
예제 #23
0
 @Test(expected = NoSuchElementException.class)
 public void shouldThrowExceptionOnSelectByReturnedValueIfOptionDoesNotExist() {
   WebElement selectElement = driver.findElement(By.name("select_empty_multiple"));
   Select select = new Select(selectElement);
   select.selectByValue("not there");
 }
  public static void main(String[] args) throws Exception {

    FirefoxProfile ffProfile = new FirefoxProfile();
    ffProfile.setPreference("network.http.phishy-userpass-length", 255);
    WebDriver driver = new FirefoxDriver(ffProfile);
    driver.get(Configuration.baseurl);
    Thread.sleep(3000);

    WebElement ExpandMobileTree = driver.findElement(By.xpath(Configuration.ExpandMobile));
    ExpandMobileTree.click();
    Thread.sleep(3000);

    WebElement ExpandSegmentTree = driver.findElement(By.xpath(Configuration.ExpandSegment));
    ExpandSegmentTree.click();
    Thread.sleep(6000);

    WebElement Segment1 = driver.findElement(By.xpath(Configuration.MobileSegment));
    Segment1.click();
    Thread.sleep(6000);

    WebElement Header = driver.findElement(By.xpath(Configuration.Header));
    Header.click();
    Thread.sleep(6000);

    WebElement Menu = driver.findElement(By.xpath(Configuration.Menu));
    Menu.click();
    Thread.sleep(6000);

    WebElement ContentTypeHint_1 = driver.findElement(By.xpath(Configuration.ContentTypeHint));

    Select selectBoxControlledSearch = new Select(ContentTypeHint_1);

    selectBoxControlledSearch.selectByValue(Configuration.Menu_hint);
    Thread.sleep(6000);

    WebElement saveHeader = driver.findElement(By.xpath(Configuration.Save));
    saveHeader.click();
    Thread.sleep(3000);

    WebElement insert = driver.findElement(By.xpath(Configuration.InsertPackage));
    insert.click();
    Thread.sleep(8000);

    WebElement CreateNewPackage = driver.findElement(By.xpath(Configuration.CreateNewPackage));
    CreateNewPackage.click();
    Thread.sleep(6000);

    WebElement EditPackage = driver.findElement(By.xpath(Configuration.NewPackage));
    EditPackage.click();
    Thread.sleep(6000);

    WebElement renamePane6 =
        driver.findElement(By.xpath("//div[@id='contents']/form/ul/li[2]/input"));
    renamePane6.clear();
    renamePane6.sendKeys("Touch header - Menu - sport section");
    Thread.sleep(100);

    WebElement renamePaneTitle6 =
        driver.findElement(By.xpath("//div[@id='contents']/form/ul/li[3]/input"));
    renamePaneTitle6.sendKeys("sport");
    Thread.sleep(100);

    WebElement save = driver.findElement(By.xpath(Configuration.Save));
    save.click();
    Thread.sleep(1000);

    WebElement Link1 = driver.findElement(By.id(Configuration.InsertMedia));

    Select selectList1 = new Select(Link1);
    // select link
    selectList1.selectByValue(Configuration.Link);

    WebElement AddLink = driver.findElement(By.xpath(Configuration.Add));
    AddLink.click();
    Thread.sleep(6000);

    WebElement urlText1 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText1.sendKeys("http://orangeworld.co.uk/p/cricket/home");
    WebElement LinkText1 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText1.sendKeys("cricket");
    WebElement reportingEnable1 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable1.click();
    WebElement reportingCampaign1 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign1.sendKeys("menu");
    WebElement reportingID1 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID1.sendKeys("header");
    WebElement AddLink1 = driver.findElement(By.xpath(Configuration.Add));
    AddLink1.click();
    Thread.sleep(3000);

    WebElement urlText2 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText2.sendKeys("http://orangeworld.co.uk/p/sportheadlines/home");
    WebElement LinkText2 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText2.sendKeys("sport headlines");
    WebElement reportingEnable2 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable2.click();
    WebElement reportingCampaign2 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign2.sendKeys("menu");
    WebElement reportingID2 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID2.sendKeys("header");
    WebElement AddLink2 = driver.findElement(By.xpath(Configuration.Add));
    AddLink2.click();
    Thread.sleep(3000);

    WebElement urlText3 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText3.sendKeys("http://orangeworld.co.uk/p/sport/livescores");
    WebElement LinkText3 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText3.sendKeys("live scores");
    WebElement reportingEnable3 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable3.click();
    WebElement reportingCampaign3 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign3.sendKeys("menu");
    WebElement reportingID3 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID3.sendKeys("header");
    WebElement AddLink3 = driver.findElement(By.xpath(Configuration.Add));
    AddLink3.click();
    Thread.sleep(3000);

    WebElement urlText4 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText4.sendKeys("http://orangeworld.co.uk/p/football/home");
    WebElement LinkText4 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText4.sendKeys("football homepage");
    WebElement reportingEnable4 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable4.click();
    WebElement reportingCampaign4 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign4.sendKeys("menu");
    WebElement reportingID4 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID4.sendKeys("header");
    WebElement AddLink4 = driver.findElement(By.xpath(Configuration.Add));
    AddLink4.click();
    Thread.sleep(3000);

    WebElement urlText5 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText5.sendKeys("http://orangeworld.co.uk/p/sport/home");
    WebElement LinkText5 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText5.sendKeys("sports homepage");
    WebElement reportingEnable5 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable5.click();
    WebElement reportingCampaign5 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign5.sendKeys("menu");
    WebElement reportingID5 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID5.sendKeys("header");
    WebElement AddLink5 = driver.findElement(By.xpath(Configuration.Add));
    AddLink5.click();
    Thread.sleep(3000);

    WebElement saveSportsLinks = driver.findElement(By.xpath(Configuration.Save));
    saveSportsLinks.click();
    Thread.sleep(1000);

    WebElement BackToMenu = driver.findElement(By.xpath(Configuration.HL_Favourites_LV));
    BackToMenu.click();
    Thread.sleep(3000);

    WebElement Menu1 = driver.findElement(By.xpath(Configuration.Menu));
    Menu1.click();
    Thread.sleep(6000);

    WebElement insert1 = driver.findElement(By.xpath(Configuration.InsertPackage));
    insert1.click();
    Thread.sleep(8000);

    WebElement CreateNewPackage1 = driver.findElement(By.xpath(Configuration.CreateNewPackage));
    CreateNewPackage1.click();
    Thread.sleep(6000);

    WebElement EditPackage1 = driver.findElement(By.xpath(Configuration.NewPackage));
    EditPackage1.click();
    Thread.sleep(6000);

    WebElement renamePane1 =
        driver.findElement(By.xpath("//div[@id='contents']/form/ul/li[2]/input"));
    renamePane1.clear();
    renamePane1.sendKeys("Touch header - Menu - news and weather section");
    Thread.sleep(100);

    WebElement renamePaneTitle1 =
        driver.findElement(By.xpath("//div[@id='contents']/form/ul/li[3]/input"));
    renamePaneTitle1.sendKeys("news & weather");
    Thread.sleep(100);

    WebElement saveNews = driver.findElement(By.xpath(Configuration.Save));
    saveNews.click();
    Thread.sleep(1000);

    WebElement urlText6 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText6.sendKeys("http://orangeworld.co.uk/p/gambling/lotto_cashgames");
    WebElement LinkText6 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText6.sendKeys("lottery results");
    WebElement reportingEnable6 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable6.click();
    WebElement reportingCampaign6 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign6.sendKeys("menu");
    WebElement reportingID6 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID6.sendKeys("header");
    WebElement AddLink6 = driver.findElement(By.xpath(Configuration.Add));
    AddLink6.click();
    Thread.sleep(3000);

    WebElement urlText7 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText7.sendKeys("http://orangeworld.co.uk/p/newsandweather/weather");
    WebElement LinkText7 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText7.sendKeys("weather forecast");
    WebElement reportingEnable7 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable7.click();
    WebElement reportingCampaign7 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign7.sendKeys("menu");
    WebElement reportingID7 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID7.sendKeys("header");
    WebElement AddLink7 = driver.findElement(By.xpath(Configuration.Add));
    AddLink7.click();
    Thread.sleep(3000);

    WebElement urlText8 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText8.sendKeys(
        "http://orangeworld.co.uk/articleindex/0/?package=general headline&provider=Sky News");
    WebElement LinkText8 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText8.sendKeys("Sky News headlines");
    WebElement reportingEnable8 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable8.click();
    WebElement reportingCampaign8 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign8.sendKeys("menu");
    WebElement reportingID8 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID8.sendKeys("header");
    WebElement AddLink8 = driver.findElement(By.xpath(Configuration.Add));
    AddLink8.click();
    Thread.sleep(3000);

    WebElement urlText9 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[3]/input"));
    urlText9.sendKeys("http://orangeworld.co.uk/p/newsandweather/home");
    WebElement LinkText9 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[4]/input"));
    LinkText9.sendKeys("news & weather homepage");
    WebElement reportingEnable9 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[8]/input"));
    reportingEnable9.click();
    WebElement reportingCampaign9 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[9]/input"));
    reportingCampaign9.sendKeys("menu");
    WebElement reportingID9 =
        driver.findElement(By.xpath("//div[@class='editFormContainer']//li[10]/input"));
    reportingID9.sendKeys("header");
    WebElement AddLink9 = driver.findElement(By.xpath(Configuration.Add));
    AddLink9.click();
    Thread.sleep(3000);

    WebElement save2 = driver.findElement(By.xpath(Configuration.Save));
    save2.click();
    Thread.sleep(1000);
  }
예제 #25
0
 public void setMaleAgeSelect(String value) {
   Select select = new Select(this.mAgeSelect);
   select.selectByValue(value);
 }
예제 #26
0
 public void setFemaleAgeSelect(String value) {
   Select select = new Select(this.fAgeSelect);
   //        System.out.println(sexSelect.getText());
   select.selectByValue(value);
 }
예제 #27
0
파일: EditUser.java 프로젝트: gaurav1609/QA
  public boolean enterandSaveValues(String user_id, String user_type) throws InterruptedException {

    boolean var1 = false;
    System.out.println(user_id);
    if (user_id == null) {
      return var1;
    }

    driver.navigate().to(url + "SchoolAdminEdit.aspx?UserId=" + user_id);
    waitForElement("MainContent_ddlUserType");

    Boolean isEnabled = driver.findElement(By.id("MainContent_ddlUserType")).isEnabled();
    System.out.println(isEnabled);
    if (isEnabled == true) {
      Select usertypedd = new Select(driver.findElement(By.id("MainContent_ddlUserType")));

      if (user_type.equalsIgnoreCase("School Admin")) {
        usertypedd.selectByValue("1");

      } else if (user_type.equalsIgnoreCase("teacher")) {
        usertypedd.selectByValue("2");
      } else if (user_type.equalsIgnoreCase("Student")) {
        usertypedd.selectByValue("3");
        waitForElement("txtSearchMultiSelect");
        List<String> teachers = Arrays.asList(teachername.split("\\s*,\\s*"));
        if (teachers.size() <= 0) {
          var1 = false;
          return var1;
        } else {
          for (int tsize = 0; tsize < teachers.size(); tsize++) {
            String teacher_name = teachers.get(tsize).trim();
            Thread.sleep(500);
            String abc = "cresMultiselect_items";
            driver.findElement(By.id("txtSearchMultiSelect")).sendKeys(teachers.get(tsize).trim());
            wait.until(
                ExpectedConditions.visibilityOf(
                    driver.findElement(
                        By.xpath(
                            "//div[contains(@class, '"
                                + abc
                                + "') and .//span[contains(.,'"
                                + teacher_name
                                + "')]]//input"))));
            Thread.sleep(1000);
            int text =
                driver
                    .findElements(
                        By.xpath(
                            "//div[contains(@class, '"
                                + abc
                                + "') and .//span[contains(.,'"
                                + teacher_name
                                + "')]]//input"))
                    .size();
            if (text >= 1) {
              if (driver
                      .findElement(
                          By.xpath(
                              "//div[contains(@class, '"
                                  + abc
                                  + "') and .//span[contains(.,'"
                                  + teacher_name
                                  + "')]]//input"))
                      .isSelected()
                  == false) {
                driver
                    .findElement(
                        By.xpath(
                            "//div[contains(@class, '"
                                + abc
                                + "') and .//span[contains(.,'"
                                + teacher_name
                                + "')]]//input"))
                    .click();
              }
              driver.findElement(By.id("txtSearchMultiSelect")).clear();
            }
          }
        }
      } else {
        usertypedd.selectByValue("1");
      }
    }

    driver.findElement(By.id("MainContent_btnSave")).click();
    // waitForElement("MainContent_lnkEdit");
    Thread.sleep(2000);
    if (isAlertPresents()) {
      driver.switchTo().alert().accept();
      driver.switchTo().defaultContent();
    }

    boolean message = isupdated();

    if (message = true) {

      var1 = true;
    } else {
      var1 = false;
    }

    return var1;
  }
예제 #28
0
 private void selectOption(String optionLabel) {
   Select inputSelect = getInputSelect();
   inputSelect.selectByValue(optionLabel);
   verifyOptionSelected(optionLabel);
 }
 /** Select the value from a dropdown list by its value */
 public void selectDropDownByValue(MethodParameters model) {
   MainTestNG.LOGGER.info("inside selectDropDownByValue");
   Select sel = new Select(model.getElement().get(0));
   sel.selectByValue(model.getData());
 }
예제 #30
0
 public void selectByValue() {
   select.selectByValue(getData());
 }