コード例 #1
1
 @InteractiveMethod
 public void invite(String eMail) {
   Actions a = new Actions(getWrappedDriver());
   invite.getWrappedElement().click();
   a.sendKeys(invite.getWrappedElement(), eMail, Keys.ENTER);
   a.perform();
 }
コード例 #2
0
 protected void appendText(WebElement inputElement, String text) {
   Actions actions = new Actions(driver);
   actions.moveToElement(inputElement);
   actions.click();
   actions.sendKeys(text);
   actions.perform();
 }
コード例 #3
0
  /**
   * Finds the menu that can be used by the owner to control the participant. Hovers over it. Finds
   * the mute link and mute it. Then checks in the second participant page whether it is muted
   */
  public void ownerMutesParticipantAndCheck() {
    System.err.println("Start ownerMutesParticipantAndCheck.");

    WebDriver owner = ConferenceFixture.getOwner();

    WebElement elem =
        owner.findElement(By.xpath("//div[@class='remotevideomenu']/i[@class='fa fa-angle-down']"));

    Actions action = new Actions(owner);
    action.moveToElement(elem);
    action.perform();

    TestUtils.waitForDisplayedElementByXPath(
        owner, "//ul[@class='popupmenu']/li/a[@class='mutelink']", 5);

    owner.findElement(By.xpath("//ul[@class='popupmenu']/li/a[@class='mutelink']")).click();

    // and now check whether second participant is muted
    TestUtils.waitForElementByXPath(
        ConferenceFixture.getSecondParticipant(),
        "//span[@class='audioMuted']/i[@class='icon-mic-disabled']",
        5);

    action.release();
  }
コード例 #4
0
  @Ignore
  @Test
  public void TestCase_005() throws Exception {

    LogGenerator.addLog(Level.INFO, "Starting Test Case_004");
    driver.get("http://myitlabgrader.com/HTML5/SIMFrame.html");
    // assertEquals("SIMs Demo", driver.getTitle());
    synchronized (driver) {
      driver.wait(12000);
    }
    System.out.println("test1");

    WebElement we = driver.findElement(By.cssSelector("#msword > img"));

    Actions action = new Actions(driver);
    action.doubleClick(we);
    action.perform();

    synchronized (driver) {
      driver.wait(12000);
    }

    String name = (new Exception().getStackTrace()[0].getMethodName());
    CaptureScreenshot.takeScreenshot(driver, name);

    synchronized (driver) {
      driver.wait(6000);
    }

    driver.findElement(By.cssSelector("span.ribbon-title.IDFileTab")).click();

    driver
        .findElement(By.xpath("html/body/div/div/div[3]/div/div/div/div/div[3]/div/div/div[4]"))
        .click();

    driver
        .findElement(
            By.xpath("/html/body/div/div/div[3]/div/div/div/div/div[3]/div/div[4]/div[3]/p[5]/img"))
        .click();

    we =
        driver.findElementByXPath(
            "/html/body/div/div/div[6]/div/div[2]/div/div/div[3]/div/div[2]/div[8]/img");

    action.doubleClick(we);
    action.perform();
  }
コード例 #5
0
ファイル: ArchiveSearchPageIT.java プロジェクト: piyush76/EMS
 protected void forcePageLoad() throws Exception {
   logMsg("Forcing page load by sending END key to folder list");
   WebElement e = getJspTestUtils().findElement(By.id("folderList"));
   Actions clicker = new Actions(getJspTestUtils().getDriver());
   clicker.moveToElement(e);
   clicker.sendKeys(e, Keys.END);
   clicker.perform();
 }
コード例 #6
0
 public static void hoverClick(WebDriver driver, String hover) throws InterruptedException {
   Thread.sleep(2000);
   Actions builder = new Actions(driver);
   Actions hoverOverRegistrar = builder.moveToElement(driver.findElement(By.xpath(hover)));
   hoverOverRegistrar.perform();
   driver.findElement(By.linkText("Sign Out")).click();
   Thread.sleep(1000);
 }
コード例 #7
0
ファイル: NewTest.java プロジェクト: Jdoing/Workspace
 @Test(dependsOnMethods = {"start"})
 public void locate() {
   dr.findElement(By.xpath("//button[contains(text(),'项目管理')]")).click();
   WebElement elt_lxsq = dr.findElement(By.linkText("立项申请"));
   Actions action = new Actions(dr);
   action.moveToElement(elt_lxsq);
   action.perform();
   dr.findElement(By.xpath("//*[contains(text(),'立项申请(30万以下切块投资项目)')]")).click();
 }
コード例 #8
0
ファイル: BasePage.java プロジェクト: prakumar/CMP-Automation
 public void focusElement(String locator) {
   waitForElement(locator);
   try {
     Actions a = new Actions(driver);
     a.moveToElement(driver.findElement(getLocator(locator)));
     a.perform();
   } catch (Exception e) {
     System.out.println("Elem not found: " + e);
   }
 }
コード例 #9
0
ファイル: Element.java プロジェクト: yuliapetrova/JDITraining
 public void clickWithKeys(Keys... keys) {
   invoker.doJAction(
       "Ctrl click on Element",
       () -> {
         Actions action = new Actions(getDriver());
         for (Keys key : keys) action = action.keyDown(key);
         action = action.moveToElement(getWebElement()).click();
         for (Keys key : keys) action = action.keyUp(key);
         action.perform();
       });
 }
コード例 #10
0
ファイル: NewTest.java プロジェクト: Jdoing/Workspace
  // 点击确认提交
  public void confirmNext() throws Exception {

    Actions actConfirm = new Actions(dr);
    actConfirm.click(dr.findElement(By.id("_btnAuditOk")));
    actConfirm.perform();

    // 动态生成的html控件最好用Actions处理
    Actions actYes = new Actions(dr);
    actYes.click(dr.findElement(By.xpath("//em//button[@value='是']"))).perform();
    System.out.println("submit-----");
    Thread.sleep(1000);
  }
コード例 #11
0
 protected void scrollbarVerticalDownScroll() {
   JavascriptExecutor js = (JavascriptExecutor) driver;
   js.executeScript("javascript:window.scrollBy(250,700)");
   WebElement pickerScroll = driver.findElement(By.className("jspDrag"));
   WebElement pickerScrollCorner = driver.findElement(By.className("jspCorner"));
   Actions builder = new Actions(driver);
   Actions movePicker = builder.dragAndDrop(pickerScroll, pickerScrollCorner); // pickerscroll
   // is
   // the
   // webelement
   movePicker.perform();
 }
コード例 #12
0
ファイル: BasePage.java プロジェクト: prakumar/CMP-Automation
 public void clickAt(String locator) {
   waitForElement(locator);
   try {
     Actions a = new Actions(driver);
     a.click(driver.findElement(getLocator(locator)));
     a.perform();
     log.info("Successfully executed CLICK At command on the following button: " + locator);
   } catch (Exception e) {
     log.error("An error occured when try to CLICK At on the following button: " + locator);
     log.debug(e);
     captureScreen(getBrowserDetails(driver) + "/operationErrors/click/clickAT" + locator, driver);
   }
 }
コード例 #13
0
 protected void scrollbarHorizontalRightScroll() {
   JavascriptExecutor js = (JavascriptExecutor) driver;
   js.executeScript("javascript:window.scrollBy(250,700)");
   WebElement pickerScroll =
       driver.findElement(
           By.xpath("//div[@id='gview_queryStatisticsList']/div[3]/div/div[3]/div[2]/div"));
   WebElement pickerScrollCorner = driver.findElement(By.className("jspCorner"));
   Actions builder = new Actions(driver);
   Actions movePicker = builder.dragAndDrop(pickerScroll, pickerScrollCorner); // pickerscroll
   // is
   // the
   // webelement
   movePicker.perform();
 }
コード例 #14
0
  @Test
  public void testMap2() throws Exception {
    driver.get(baseUrl + "/ModSolarPlatform/login.jsp;jsessionid=F33B6C551CBA0A359E87354993539EFA");
    driver.findElement(By.id("username")).clear();
    driver.findElement(By.id("username")).sendKeys("christianqa");
    driver.findElement(By.id("password")).clear();

    driver.findElement(By.id("password")).sendKeys("qa");
    driver.findElement(By.name("submit")).click();
    driver.findElement(By.cssSelector("div.newLeadList")).click();
    driver.findElement(By.id("tabResidential")).click();
    driver.findElement(By.id("firstNameResidential")).clear();
    driver.findElement(By.id("firstNameResidential")).sendKeys("christian");
    driver.findElement(By.id("lastNameResidential")).clear();
    driver.findElement(By.id("lastNameResidential")).sendKeys("Mabila");
    driver.findElement(By.id("addressResidential")).clear();
    driver.findElement(By.id("addressResidential")).sendKeys("600 Clipper rd");
    driver.findElement(By.id("cityResidential")).clear();
    driver.findElement(By.id("cityResidential")).sendKeys("Belmont");
    new Select(driver.findElement(By.id("stateResidential"))).selectByVisibleText("California");
    // driver.findElement(By.id("zipCodeResidential")).clear();
    // driver.findElement(By.id("zipCodeResidential")).sendKeys("90042");
    driver.findElement(By.cssSelector("#zipCodeResidential")).clear();
    driver.findElement(By.cssSelector("#zipCodeResidential")).sendKeys("90042");
    Thread.sleep(1500);
    driver.findElement(By.id("emailResidential")).clear();
    driver.findElement(By.id("emailResidential")).sendKeys("*****@*****.**");
    driver.findElement(By.id("utilityTaxRateInputAddressResidential")).clear();
    driver.findElement(By.id("utilityTaxRateInputAddressResidential")).sendKeys("1.2");
    driver.findElement(By.id("averageMonthlyBillResidential")).clear();
    driver.findElement(By.id("averageMonthlyBillResidential")).sendKeys("225");
    driver.findElement(By.id("nextBtn")).click();
    Thread.sleep(1000);

    WebElement mainCanvas = driver.findElement(By.xpath(".//*[@id='mapCanvas']/div/div[1]/div[2]"));

    Actions mouseAction = new Actions(driver);

    mouseAction.moveToElement(mainCanvas);

    mouseAction.contextClick(mainCanvas);

    mouseAction.moveByOffset(5, 25);

    mouseAction.sendKeys(Keys.ARROW_DOWN);

    mouseAction.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction.click();

    mouseAction.perform();

    WebElement mainCanvas2 =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    Actions mouseAction2 = new Actions(driver);

    mouseAction2.moveToElement(mainCanvas2);

    mouseAction2.contextClick(mainCanvas2);

    mouseAction2.moveByOffset(70, 50);

    mouseAction2.sendKeys(Keys.ARROW_DOWN);

    mouseAction2.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction2.click();

    mouseAction2.perform();

    WebElement mainCanvas3 =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    Actions mouseAction3 = new Actions(driver);

    mouseAction3.moveToElement(mainCanvas3);

    mouseAction3.contextClick(mainCanvas3);

    mouseAction3.moveToElement(mainCanvas2, 500, 220);

    mouseAction3.sendKeys(Keys.ARROW_DOWN);

    mouseAction3.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction3.click();

    mouseAction3.perform();

    // Clicking inside the Triangle

    WebElement e =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(e, 0, 0).moveByOffset(520, 255).click().build().perform();
    driver.findElement(By.cssSelector("div.pgNext.right > input.btn")).click();
    driver.findElement(By.xpath("//div[@id='accordion']")).click();
    driver.findElement(By.id("regionsPaneTitle")).click();

    // Clicking inside the Triangle 1

    WebElement eI =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(eI, 0, 0).moveByOffset(520, 255).click().build().perform();

    Thread.sleep(1000);

    // Clicking inside the Triangle 1

    WebElement eS =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(eS, 0, 0).moveByOffset(520, 255).click().build().perform();
    Thread.sleep(1000);
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click();
    ////
    // driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")).click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("52");
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("18");
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("45");
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();

    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click();
    driver.findElement(By.cssSelector("label.overTxtLabel")).click();
    driver.findElement(By.id("proposalName")).sendKeys("AUTOMATION TEST");
    driver.findElement(By.id("regionsPaneTitle")).click();
    driver.findElement(By.id("regionsPaneTitle")).click();
    Thread.sleep(500);
    /// driver.findElement(By.id("squareUpButton2")).click();
    driver.findElement(By.xpath("//input[@id='snapAzimuthButton1']")).click();
    driver.findElement(By.xpath("//input[@id='applySetbacksButton1']")).click();
    /// assertEquals("Setbacks cannot be less than zero.", closeAlertAndGetItsText());
    //// driver.findElement(By.id("delPolygonButton2")).click();
    Thread.sleep(1000);
    /// driver.findElement(By.id("squareUpButton3")).click();
    /// driver.findElement(By.id("squareUpButton3")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan up\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan right\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan down\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan left\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Zoom out\"] > img")).click();
    driver.findElement(By.cssSelector("div[title=\"Zoom in\"] > img")).click();
    driver.findElement(By.id("accordion")).click();
    /////
    /////
    ////
    /// no need driver.findElement(By.xpath("//div[@id='solutionCategory']/ul/li[2]/h3")).click();
    /// no need driver.findElement(By.cssSelector("span.arrow")).click();
    driver.findElement(By.xpath("//input[@value='Next']")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("accordionTitleText")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("nextButton")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("contentUsagePaneTitle")).click();
    driver.findElement(By.id("accordion")).click();
    Thread.sleep(1000);
    // click on Inverters
    driver.findElement(By.xpath("//h3[text()= 'Inverters']")).click();

    // Click on Arrow

    driver.findElement(By.xpath("//span[@class = 'arrow']")).click();

    Thread.sleep(1000);
    // Default Invert select
    driver.findElement(By.xpath("html/body/ul/li[2]/span")).click();

    // Click on Arrow
    driver.findElement(By.xpath("//span[@class = 'arrow']")).click();

    Thread.sleep(2000);

    // Click on Next button
    driver.findElement(By.xpath("//input[@value='Next']")).click();
    Thread.sleep(2000);
    ////// errror--- driver.findElement(By.id("supplyLeadDetailsBtn1")).click();
    driver.findElement(By.id("accordion")).click();
    ///// driver.findElement(By.id("accordion")).click();
    ////// driver.findElement(By.id("accordion")).click();
    Thread.sleep(1500);

    ///// driver.findElement(By.id("backBtn")).click();
    //// driver.findElement(By.cssSelector("label > input[type=\"button\"]")).click();
    // Click on Next button

    driver.findElement(By.xpath("//input[@id='nextButton']")).click();

    /// PREVIEW PAGE STARTS HERE
    Thread.sleep(2000);

    driver.findElement(By.id("accordion")).click();
    Thread.sleep(250);
    driver.findElement(By.cssSelector("#buyForCashCheckbox")).click();
    Thread.sleep(250);
    driver.findElement(By.cssSelector("#nextButton")).click();
    Thread.sleep(1000);

    // ERROR: Caught exception [unknown command []]
  }
コード例 #15
0
 private void moveAndClick(By by) {
   WebElement el = driver.findElement(by);
   actions.moveToElement(el);
   actions.click();
   actions.perform();
 }
コード例 #16
0
 private void moveToElement(WebElement webElement) {
   Actions actions = new Actions(webdriver());
   actions.moveToElement(webElement);
   actions.perform();
 }