Example usage for org.openqa.selenium By tagName

List of usage examples for org.openqa.selenium By tagName

Introduction

In this page you can find the example usage for org.openqa.selenium By tagName.

Prototype

public static By tagName(String tagName) 

Source Link

Usage

From source file:br.ufmg.dcc.saotome.beholder.selenium.WebDriverAdapter.java

License:Apache License

@Override
public WebElement findElement(final By by) {

    final String tag = "html";

    // It's instanced a html element to reuse the findElement of WebElementAdapter
    WebElement html = this.driver.findElement(By.tagName(tag));
    WebElement htmlAdapter = new WebElementAdapter(html, null, By.tagName(tag));

    return htmlAdapter.findElement(by);
}

From source file:ca.nrc.cadc.search.integration.UnauthorizedPreviewPage.java

License:Open Source License

@Override
void waitForPageLoad() throws Exception {
    waitForTextPresent(By.tagName("p"), "You do not have permission to view this Preview image.");
}

From source file:ca.nrc.cadc.UserStorageBrowserPage.java

License:Open Source License

int getTableRowCount() throws Exception {
    List<WebElement> tableRows = beaconTable.findElements(By.tagName("tr"));
    return tableRows.size();
}

From source file:ca.nrc.cadc.UserStorageBrowserPage.java

License:Open Source License

boolean verifyFolderName(int rowNum, String expectedValue) throws Exception {
    List<WebElement> tableRows = beaconTable.findElements(By.tagName("tr"));
    WebElement selectedRow = tableRows.get(rowNum);
    WebElement namecolumn = selectedRow.findElement(By.cssSelector("a:nth-of-type(1)"));
    System.out.println(namecolumn.getText());
    return expectedValue.equals(namecolumn.getText());

}

From source file:ca.nrc.cadc.UserStorageBrowserPage.java

License:Open Source License

boolean verifyFolderSize(int rowNum) throws Exception {
    List<WebElement> tableRows = beaconTable.findElements(By.tagName("tr"));
    WebElement selectedRow = tableRows.get(rowNum);
    List<WebElement> columns = selectedRow.findElements(By.tagName("td"));
    String sizeString = columns.get(2).getText();
    return sizeString != null;
}

From source file:ca.nrc.cadc.UserStorageBrowserPage.java

License:Open Source License

public String getFolderName(int rowNum) throws Exception {
    List<WebElement> tableRows = beaconTable.findElements(By.tagName("tr"));
    WebElement selectedRow = tableRows.get(rowNum);
    WebElement namecolumn = selectedRow.findElement(By.cssSelector("a:nth-of-type(1)"));
    System.out.println("Foldername to be returned: " + namecolumn.getText());
    return namecolumn.getText();
}

From source file:calc.CalculatorUIT.java

public void testCodesCrud(DesiredCapabilities browser) throws Exception {

    ExtentReports logger = new ExtentReports("target//advancedReport.html", false);
    ExtentTest test1 = logger.startTest("Verify Target String");
    ExtentTest test2 = logger.startTest("Verify Calculation Result");

    WebDriver driver = null;//from w  w w  . ja  v a2s  .  co  m
    System.out.println("Attempt connect to Selenium Node @ " + NodeURL);
    File pathToBinary = new File("/opt/firefox46/firefox/firefox-bin");
    FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);
    FirefoxProfile firefoxProfile = new FirefoxProfile();
    driver = new FirefoxDriver(ffBinary, firefoxProfile);
    try {
        System.out.println("attempt connect to target: " + TargetURL);
        driver.get(TargetURL);
        //input a addition 12+8 example in the calculator web-application;
        driver.findElement(By.xpath("(//input[@id='buttonRow'])[2]")).click();
        driver.findElement(By.xpath("(//input[@id='buttonRow'])[3]")).click();
        driver.findElement(By.xpath("(//input[@id='buttonRow'])[12]")).click();
        driver.findElement(By.xpath("(//input[@id='buttonRow'])[10]")).click();
        driver.findElement(By.xpath("(//input[@id='buttonRow'])[15]")).click();

        //search target string value
        String targetStr = "Welcome to the Demo";

        //verify result
        boolean isFound = (driver.findElement(By.tagName("body")).getText()).contains(targetStr);
        boolean result = driver.findElement(By.name("display")).getAttribute("value").contains("84");

        //verify title  
        if (isFound == true) {
            test1.log(LogStatus.PASS, "Title has been verified");
        }
        if (isFound == false) {
            test1.log(LogStatus.FAIL, "Title has NOT been verified");
        }

        //verify result     
        if (result == true) {
            test2.log(LogStatus.PASS,
                    "The Calculation result was correct: [12 multiply by 7 gave output of 84]");
        } else {
            test2.log(LogStatus.FAIL,
                    "The Calculation result was not correct [the title is[Welcome to the Demo!]");

        }
        logger.endTest(test1);
        logger.endTest(test2);
        logger.flush();

        System.out.println("look for= [" + targetStr + "]");
        System.out.println("did we find it? [" + isFound + "]");

        System.out.println("calculate 12 multiply by 7");
        System.out.println("Was the result 84 ? [" + result + "]");

        Assert.assertTrue(isFound);
        Assert.assertTrue(result);
        //  Assert.assertEquals("hell",driver.getTitle());
        //doTest(driver); 
        // rest of test commands come here
    } catch (Exception e) {
        e.printStackTrace();
        Assert.assertTrue(e.getMessage(), false);
    } finally {
        if (driver != null) {
            driver.quit();
        }
    }
}

From source file:cc.kune.selenium.PageObject.java

License:GNU Affero Public License

/**
 * Checks if is text present.//  w w w  .j av a  2 s. c o m
 * 
 * @param text
 *          the text
 * @return true, if is text present
 */
public boolean isTextPresent(final String text) {
    return webdriver.findElement(By.tagName("body")).getText().contains(text);
}

From source file:ch.admin.isb.hermes5.common.AbstractPageDriver.java

License:Apache License

public List<WebElement> allOptions(WebElement selectOneMenu) {
    return selectOneMenu.findElements(By.tagName("option"));
}

From source file:ch.admin.isb.hermes5.common.AbstractPageDriver.java

License:Apache License

public String getBody() {
    return findElement(By.tagName("body")).getText();
}