Example usage for org.openqa.selenium By linkText

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

Introduction

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

Prototype

public static By linkText(String linkText) 

Source Link

Usage

From source file:com.moodle.testmanager.pageObjectModel.Users.java

License:GNU General Public License

/**
 * Select the login link that is available when logged out
 *///from   w w  w . ja  va  2  s  .c  om
public void selectLoginLink() {
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    WebElement login;
    login = driver.findElement(By.linkText(this.properties.get("loginLink")));
    login.click();
}

From source file:com.mvnsnm.Register.java

public void deleteuser() {

    driver.get("http://localhost:8801");

    driver.findElement(By.linkText("Change Password")).click();

    //Change Password
    final String userdelete = "Delete User";

    WebElement deleteuser = driver.findElement(By.xpath("//span[@id='userdelete']"));

    deleteuser.click();/*  ww w.  j  a  v a  2s .c  om*/

    Assert.assertEquals(userdelete, deleteuser.getText());

    driver.findElement(By.xpath("//input[@id='username']")).sendKeys(properties.get("username"));

    driver.findElement(By.xpath("//input[@id='password']")).sendKeys(properties.get("password"));

    Reuseable.sleep(3);

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

    Reuseable.sleep(5);

    Assert.assertEquals(properties.get("accountdeleted"),
            driver.findElement(By.xpath("//li[@id='useraccountdeleted']")).getText());

}

From source file:com.nowsprinting.hellotesting.appiumtest.selendroid.page.SelendroidDetailPage.java

License:Apache License

@Override
public DetailPage selectGender(Gender gender) {
    /*/*from  www .j av a  2 s  . c  om*/
     * ---------------------------
     * RadioGroup (contentDescription="gender segmentedcontrol")
     * RadioButton ("")
     * RadioButton ("")
     * ---------------------------
     * ???????????
     * contentDescrption?"gender segmentedcontrol"???????
     * ????????????
     */
    if (gender != null) {
        WebElement genderRadioGroup = mDriver.findElement(By.name("gender segmentedcontrol"));
        genderRadioGroup.findElement(By.linkText(gender.getRadioButtonText())).click();
    }
    return this;
}

From source file:com.nuxeo.functionaltests.AbstractDAMTest.java

License:Open Source License

@After
public void cleanupAssetLibrary() throws DocumentBasePage.UserNotConnectedException {
    login();/*from w  w w  . j a v  a  2s. c om*/
    driver.findElement(By.linkText("Asset Library")).click();
    asPage(DocumentBasePage.class).getContentTab().removeAllDocuments();
    logout();
}

From source file:com.nuxeo.functionaltests.AbstractDAMTest.java

License:Open Source License

protected DAMPage getDAMPage() {
    findElementWithTimeout(By.linkText("DAM")).click();
    return asPage(DAMPage.class);
}

From source file:com.nuxeo.functionaltests.AbstractDAMTest.java

License:Open Source License

/**
 * Creates a test user with given name and password, and give it write
 * rights on Asset Library/*from   ww  w .java2s . c  om*/
 *
 */
protected void createTestUser(String username, String password, String grantPermission)
        throws DocumentBasePage.UserNotConnectedException {
    UsersGroupsBasePage page;
    DocumentBasePage base = login();
    try {
        UsersTabSubPage usersTab = base.getAdminCenter().getUsersGroupsHomePage().getUsersTab();
        usersTab = usersTab.searchUser(username);
        if (!usersTab.isUserFound(username)) {
            page = usersTab.getUserCreatePage().createUser(username, "", "", "company1", "email1", password,
                    "members");
            page.getUsersTab(true);
            // Go to Workspaces
            DocumentBasePage dm = base.getDocumentManagement();
            driver.findElement(By.linkText("Asset Library")).click();
            DocumentBasePage assetLibraryPage = dm.asPage(DocumentBasePage.class);
            AccessRightsSubPage rightsPage = assetLibraryPage.getManageTab().getAccessRightsSubTab();
            rightsPage.addPermissionForUser(username, grantPermission, true);
        }
    } finally {
        logout();
    }
}

From source file:com.nuxeo.functionaltests.ITEventCreationTest.java

License:Open Source License

@After
public void cleanup() throws DocumentBasePage.UserNotConnectedException {
    login();/* www .  j a v a2  s . c o m*/
    driver.findElement(By.linkText("Workspaces")).click();
    asPage(DocumentBasePage.class).getContentTab().removeAllDocuments();
    logout();
}

From source file:com.nuxeo.functionaltests.ITReadOnlyUserTest.java

License:Open Source License

@Test
public void testReadOnlyUser() throws Exception {
    login("leela", "test");
    DAMPage damPage = getDAMPage();/*from   w w w .  j a  va2 s. c o m*/
    damPage = damPage.createAsset("File", "One Document", "One File description", "Leela", "1/1/2012");
    damPage = damPage.createAsset("File", "Another Document", "Another File description", "Fry", "1/1/2012");
    damPage.createAsset("File", "Sample picture", "This is a sample doc", "Bender", "1/2/2012");
    logout();

    login("bender", "test");
    // make sure navigation to a given domain is done, see NXP-13436
    findElementWithTimeout(By.linkText("DOCUMENT MANAGEMENT")).click();
    findElementWithTimeout(By.linkText("Default domain")).click();
    damPage = getDAMPage();
    SearchResultsFragment searchResultsFragment = damPage.getSearchResultsFragment();
    // Asset Library is not selected as the user does not have Write right
    // on it
    AssetCreationFancyBoxFragment assetCreation = searchResultsFragment.showAssetCreation(damPage);
    assetCreation.checkTextToBeNotPresent("Asset Library");
    assetCreation.cancel();

    // cannot bulk edit, but can add to worklist
    String bEditButtonId = "nxl_gridDamLayout:dam_search_nxw_searchResults_buttons:nxw_damBulkEdit_form:nxw_cvButton_damBulkEdit_subview:nxw_cvButton_damBulkEdit_link";
    String addToWLButtonId = "nxl_gridDamLayout:dam_search_nxw_searchResults_buttons:nxw_CURRENT_SELECTION_ADDTOLIST_form:nxw_CURRENT_SELECTION_ADDTOLIST";

    searchResultsFragment.selectAll();
    WebElement bulkEditButton = driver.findElement(By.id(bEditButtonId));
    assertFalse(bulkEditButton.isEnabled());

    // make sure ajax request is done, otherwise we might get stack traces
    findElementAndWaitUntilEnabled(By.id(addToWLButtonId));

    // cannot edit any metadata on the asset view
    assertFalse(damPage.hasElement(By.xpath("//div[contains(@class, 'foldableBox')]//a[text()='Edit']")));
    logout();
}

From source file:com.oracle.pgbu.p6web.helper.DataHelper.java

/**
* Click a link using the link text.//from w w w. j  a  va 2 s . c  om
* @param linkText
* @param m_driver Webdriver instance
*/
public void clickLink(String linkText, WebDriver m_driver) {
    m_driver.findElement(By.linkText(linkText)).click();
}

From source file:com.palmetto.testautomation.pom.PalmettoVolunteerPageObject.java

public void GoToVolunteerApplicationPage() {

    driver.findElement(By.linkText(prop.getProperty("GivingLinkText"))).click();
    driver.findElement(By.linkText(prop.getProperty("VolunteerProgramLinkText"))).click();
    driver.findElement(By.xpath(prop.getProperty("VolunteerApplicationLinkText"))).click();
}