Example usage for org.openqa.selenium By name

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

Introduction

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

Prototype

public static By name(String name) 

Source Link

Usage

From source file:com.phleet.augusta.Slide_Menu.java

public void slide_Menu_Profile() throws InterruptedException {
    Thread.sleep(3000);/*from   w  w  w.  ja  v  a 2 s.  c  om*/
    driver.findElement(By.name("rightBarButtonImage")).click();
    Thread.sleep(5000);
    driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[3]")).click();
    Thread.sleep(15000);
    slide_menu.slide_Menu_Chnage_Password();
    //driver.quit();
}

From source file:com.phleet.augusta.Slide_Menu.java

public void slide_Menu_Chnage_Password() throws InterruptedException {

    driver.findElement(By.name("rightBarButtonImage")).click();
    Thread.sleep(5000);//from w  w w .  j  a v a  2s .  c om
    driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]")).click();
    Thread.sleep(15000);
    slide_menu.slide_Menu_Legal();
}

From source file:com.phleet.augusta.Slide_Menu.java

public void slide_Menu_Legal() throws InterruptedException {
    driver.findElement(By.name("rightBarButtonImage")).click();
    Thread.sleep(5000);//from  w  w w.ja v  a  2  s .co m
    driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[6]")).click();
    Thread.sleep(15000);
    slide_menu.slide_Menu_Signout();
    //driver.quit();
}

From source file:com.phleet.augusta.Slide_Menu.java

public void slide_Menu_Signout() throws InterruptedException {
    driver.findElement(By.name("rightBarButtonImage")).click();
    Thread.sleep(5000);/*from  w  w w  .  j av a  2s .  co  m*/
    driver.scrollTo("Sign Out").click();
    driver.findElement(
            By.xpath("//UIAApplication[1]/UIAWindow[4]/UIAAlert[1]/UIACollectionView[1]/UIACollectionCell[1]"))
            .click();
    Thread.sleep(15000);
    driver.quit();
}

From source file:com.photon.phresco.Screens.InvalidJarBase.java

public void addInvalidJarModules(String methodName) throws Exception {
    if (StringUtils.isEmpty(methodName)) {
        methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
    }/*from w w w . j av a  2s.com*/
    log.info("@testReusableComponentsAddPhpModulesPage::******executing addPhpModules scenario****");
    try {

        Thread.sleep(2000);
        waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName);
        element = getXpathWebElement(uiConstants.COMPONENTS_LINK);
        click();
        Thread.sleep(3000);

        waitForElementPresent(uiConstants.CUSTOMER_DROPDOWN_VALUE, methodName);
        getXpathWebElement(uiConstants.CUSTOMER_DROPDOWN_VALUE).click();
        Thread.sleep(15000);
        waitForTextPresent("Android Hybrid");
        Thread.sleep(2000);

        element = getXpathWebElement(uiConstants.REASUABLE_COMPONENT_TAB);
        waitForElementPresent(uiConstants.REASUABLE_COMPONENT_TAB, methodName);
        click();
        Thread.sleep(2000);

        element = getXpathWebElement(uiConstants.ADD_MODULES_BUTTON);
        waitForElementPresent(uiConstants.ADD_MODULES_BUTTON, methodName);
        click();
        Thread.sleep(1000);

        element = getXpathWebElement(uiConstants.MODULES_NAME);
        waitForElementPresent(uiConstants.MODULES_NAME, methodName);
        type(adminUIConstants.ADD_MODULE_PHP_NAME_VALUE);

        Thread.sleep(1000);

        element = getXpathWebElement(uiConstants.MODULE_DESCRIPTION);
        waitForElementPresent(uiConstants.MODULE_DESCRIPTION, methodName);
        type(adminUIConstants.ADD_MODULE_PHP_DESCRIPTION_VALUE);
        Thread.sleep(1000);

        element = getXpathWebElement(uiConstants.MODULE_HELPTEXT);
        waitForElementPresent(uiConstants.MODULE_HELPTEXT, methodName);
        type(adminUIConstants.ADD_MODULE_PHP_HELPTEXT_VALUE);
        Thread.sleep(1000);

        /*element=getXpathWebElement(uiConstants.MODULE_TECHNOLOGY);
        waitForElementPresent(uiConstants.MODULE_TECHNOLOGY, methodName);
        click();*/
        Thread.sleep(6000);
        AddingTechnology(methodName);
        Thread.sleep(5000);

        Thread.sleep(3000);

        element = getXpathWebElement(uiConstants.MODULE_MODULETYPE);
        waitForElementPresent(uiConstants.MODULE_MODULETYPE, methodName);
        click();
        type(adminUIConstants.ADD_MODULE_PHP_CUSTOM_MODULE_VALUE);
        click();
        Thread.sleep(3000);

        element = getXpathWebElement(uiConstants.MODULE_LICENSE_TYPE);
        waitForElementPresent(uiConstants.MODULE_LICENSE_TYPE, methodName);
        click();
        type(adminUIConstants.ADD_MODULE_PHP_LICENSE_TYPE_VALUE);
        click();
        Thread.sleep(3000);

        System.out.println("--------------Upload File----------");
        driver.findElement(By.name("file")).sendKeys("D:\\jars\\docs\\PHTN_Reference_Guide.doc");

        Thread.sleep(4000);
        System.out.println("--------------Upload File----------");

        /*element=getXpathWebElement("//div/label[contains(text(),'Upload File')]");
        Thread.sleep(2000);
        element.sendKeys("c:\\");
        element.submit();*/

        //   Runtime.getRuntime().exec("C:/Documents and Settings/srividya_su/Desktop/site_uploadfile.exe");
        //   Thread.sleep(8000);

        //SELECT DEPENDENCY CURRENTLY NOT WORKING

        /*element=getXpathWebElement(uiConstants.MODULE_SELECT_DEPENDENCY);
        waitForElementPresent(uiConstants.MODULE_SELECT_DEPENDENCY, methodName);
        click();
        Thread.sleep(3000);
                
        element=getXpathWebElement(uiConstants.MODULE_DEPENDENCY_LOGIN_CHECKBOX);
        waitForElementPresent(uiConstants.MODULE_DEPENDENCY_LOGIN_CHECKBOX, methodName);
        click();
                
        element=getXpathWebElement(uiConstants.MODULE_DEPENDENCY_OK_BUTTON);
        waitForElementPresent(uiConstants.MODULE_DEPENDENCY_OK_BUTTON, methodName);
        click();*/
        Thread.sleep(1000);
        System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        /*element=getXpathWebElement(uiConstants.MODULE_SAVE_BUTTON);
        log.info("--("+ element +")--");
        waitForElementPresent(uiConstants.MODULE_SAVE_BUTTON, methodName);
        click();*/

        isTextPresent(adminUIConstants.TEXT_ERROR_MSG);
        element = getXpathWebElement(uiConstants.MODULE_CANCEL_BUTTON);

        waitForElementPresent(uiConstants.MODULE_CANCEL_BUTTON, methodName);
        click();

        //isTextPresent(adminUIConstants.TEXT_SUCCESSS_MSG);
        //Thread.sleep(10000);

        /*element=getXpathWebElement(uiConstants.MODULE_CANCEL_BUTTON);
        waitForElementPresent(uiConstants.MODULE_CANCEL_BUTTON, methodName);
        click();
        Thread.sleep(1000);*/

    } catch (InterruptedException e) {

        e.printStackTrace();
    }
}

From source file:com.photon.phresco.Screens.InvalidJarBase.java

public void addModules(String methodName) throws Exception {
    if (StringUtils.isEmpty(methodName)) {
        methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
    }/*from   w ww. j a v a2  s . c o  m*/
    log.info("@testReusableComponentsAddPhpModulesPage::******executing addPhpModules scenario****");
    try {

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.COMPONENTS_LINK);
        waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName);
        click();
        Thread.sleep(3000);

        getXpathWebElement(uiConstants.CUSTOMER_DROPDOWN).click();
        getXpathWebElement(adminUIConstants.CUSTOMER_DROPDOWN_VALUE).click();
        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.REASUABLE_COMPONENT_TAB);
        waitForElementPresent(uiConstants.REASUABLE_COMPONENT_TAB, methodName);
        click();
        Thread.sleep(1000);

        element = getXpathWebElement(uiConstants.ADD_MODULES_BUTTON);
        waitForElementPresent(uiConstants.ADD_MODULES_BUTTON, methodName);
        click();
        Thread.sleep(1000);

        try {

            if (methodName == "testPHPCreateApplicationLayerArchetypesPage"
                    || methodName == "testDrupal6CreateApplicationLayerArchetypesPage"
                    || methodName == "testDrupal7CreateApplicationLayerArchetypesPage"
                    || methodName == "testWordPressCreateApplicationLayerArchetypesPage") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_PHP_TECHNOLOGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testDOTNETCreateApplicationLayerArchetypesPage"
                    || methodName == "testSharePointCreateApplicationLayerArchetypesPage"
                    || methodName == "testSiteCoreCreateApplicationLayerArchetypesPage") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_DOTNET_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testNodejsCreateApplicationLayerArchetypesPage") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_NODEJS_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testJavaStandaloneCreateApplicationLayerArchetypesPage"
                    || methodName == "testJavaWebServiceCreateApplicationLayerArchetypesPage") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_JAVASTANDALONE_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testiPhoneHybridCreateMobileLayerArchetypes"
                    || methodName == "testiphoneNativeCreateMobileLayerArchetypes"
                    || methodName == "testiPhoneLibraryCreateMobileLayerArchetypes"
                    || methodName == "testiPhoneWorkSpaceCreateMobileLayerArchetypes") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_IPHONEHYBRID_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testAndroidHybridCreateMobileLayerArchetypes"
                    || methodName == "testAndroidNativeCreateMobileLayerArchetypes"
                    || methodName == "testAndroidLibraryCreateMobileLayerArchetypes") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_ANDROIDHYBRID_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testWindowsMetroCreateMobileLayerArchetypes"
                    || methodName == "testWindowsPhoneCreateMobileLayerArchetypes") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_WINDOWSMETRO_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testBlackBerryHybridCreateMobileLayerArchetypes") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_BLACKBERRY_HYBRID_TECHONOLGY_VALUE)
                        .click();
                Thread.sleep(2000);
            }

        } catch (Exception e) {

            e.printStackTrace();
        }

        element = getXpathWebElement(uiConstants.MODULES_NAME);
        waitForElementPresent(uiConstants.MODULES_NAME, methodName);
        //type(adminUIConstants.ADD_MODULE_PHP_NAME_VALUE);
        type(methodName);
        Thread.sleep(1000);

        element = getXpathWebElement(uiConstants.MODULE_DESCRIPTION);
        waitForElementPresent(uiConstants.MODULE_DESCRIPTION, methodName);
        type(adminUIConstants.ADD_MODULE_PHP_DESCRIPTION_VALUE);
        Thread.sleep(1000);

        element = getXpathWebElement(uiConstants.MODULE_HELPTEXT);
        waitForElementPresent(uiConstants.MODULE_HELPTEXT, methodName);
        type(adminUIConstants.ADD_MODULE_PHP_HELPTEXT_VALUE);
        Thread.sleep(1000);

        /*element=getXpathWebElement(uiConstants.MODULE_TECHNOLOGY);
        waitForElementPresent(uiConstants.MODULE_TECHNOLOGY, methodName);
        click();*/
        Thread.sleep(6000);
        AddingTechnology(methodName);

        Thread.sleep(3000);

        element = getXpathWebElement(uiConstants.MODULE_MODULETYPE);
        waitForElementPresent(uiConstants.MODULE_MODULETYPE, methodName);
        click();
        type(adminUIConstants.ADD_MODULE_PHP_CUSTOM_MODULE_VALUE);
        click();
        Thread.sleep(3000);

        element = getXpathWebElement(uiConstants.MODULE_LICENSE_TYPE);
        waitForElementPresent(uiConstants.MODULE_LICENSE_TYPE, methodName);
        click();
        type(adminUIConstants.ADD_MODULE_PHP_LICENSE_TYPE_VALUE);
        click();
        Thread.sleep(3000);

        System.out.println("--------------Upload File----------");
        driver.findElement(By.name("file")).sendKeys(
                "D:\\Test\\Phresco-Build-2.0.0.32000\\phresco-framework\\tools\\maven\\lib\\aether-impl-1.11.jar");

        Thread.sleep(4000);
        System.out.println("--------------Upload File----------");

        /*element=getXpathWebElement("//div/label[contains(text(),'Upload File')]");
        Thread.sleep(2000);
        element.sendKeys("c:\\");
        element.submit();*/

        //   Runtime.getRuntime().exec("C:/Documents and Settings/srividya_su/Desktop/site_uploadfile.exe");
        //   Thread.sleep(8000);

        //SELECT DEPENDENCY CURRENTLY NOT WORKING

        /*element=getXpathWebElement(uiConstants.MODULE_SELECT_DEPENDENCY);
        waitForElementPresent(uiConstants.MODULE_SELECT_DEPENDENCY, methodName);
        click();
        Thread.sleep(3000);
                
        element=getXpathWebElement(uiConstants.MODULE_DEPENDENCY_LOGIN_CHECKBOX);
        waitForElementPresent(uiConstants.MODULE_DEPENDENCY_LOGIN_CHECKBOX, methodName);
        click();
                
        element=getXpathWebElement(uiConstants.MODULE_DEPENDENCY_OK_BUTTON);
        waitForElementPresent(uiConstants.MODULE_DEPENDENCY_OK_BUTTON, methodName);
        click();*/
        Thread.sleep(1000);
        System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        element = getXpathWebElement(uiConstants.MODULE_SAVE_BUTTON);
        log.info("--(" + element + ")--");
        waitForElementPresent(uiConstants.MODULE_SAVE_BUTTON, methodName);
        click();
        System.out.println("--------------Module Creation----------");
        waitForTextPresent(adminUIConstants.TEXT_SUCCESSS_MSG);
        System.out.println("--------------Module Created----------");
        //isTextPresent(adminUIConstants.TEXT_SUCCESSS_MSG);
        //Thread.sleep(10000);

        /*element=getXpathWebElement(uiConstants.MODULE_CANCEL_BUTTON);
        waitForElementPresent(uiConstants.MODULE_CANCEL_BUTTON, methodName);
        click();
        Thread.sleep(1000);*/

    } catch (InterruptedException e) {

        e.printStackTrace();
    }
}

From source file:com.photon.phresco.Screens.InvalidJarBase.java

public void addInvalidVideoFile(String methodName) throws Exception {
    if (StringUtils.isEmpty(methodName)) {
        methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
    }//from   w w w .  j  a  v  a 2s . co  m
    try {

        Thread.sleep(3000);
        waitForElementPresent(uiConstants.ADMIN_LINK, methodName);
        element = getXpathWebElement(uiConstants.ADMIN_LINK);
        click();
        //   waitForTextPresent("Customers");
        //   Thread.sleep(20000);
        getXpathWebElement(uiConstants.VIDEOS_BUTTON);
        waitForElementPresent(uiConstants.VIDEOS_BUTTON, methodName);
        click();
        Thread.sleep(2000);
        getXpathWebElement(uiConstants.VIDEOS_ADD);
        waitForElementPresent(uiConstants.VIDEOS_ADD, methodName);
        click();
        Thread.sleep(1000);
        getXpathWebElement(uiConstants.VIDEOS_ADD);
        waitForElementPresent(uiConstants.VIDEOS_NAME, methodName);
        click();
        type(adminUIConstants.VIDEO_NAME_VALUE);
        getXpathWebElement(uiConstants.VIDEOS_DESCRIPTION);
        waitForElementPresent(uiConstants.VIDEOS_DESCRIPTION, methodName);
        click();
        type(adminUIConstants.VIDEO_DESCRIPTION_VALUE);
        System.out.println("--------------Upload MP4 File----------");
        driver.findElement(By.name("file")).sendKeys(
                "C:\\Documents and Settings\\kalish_ma\\Desktop\\jars\\Thavarugal Paesum [_______ ______] - Tamil Short Film Teaser Trailer HD.mp4");
        Thread.sleep(5000);
        System.out.println("--------------Upload Png Image File----------");
        driver.findElement(By.name("file"))
                .sendKeys("C:\\Documents and Settings\\vairamuthu_m\\Desktop\\fsdfdsf.PNG");
        Thread.sleep(5000);
        getXpathWebElement(uiConstants.VIDEOS_SAVE);
        waitForElementPresent(uiConstants.VIDEOS_SAVE, methodName);
        click();
        Thread.sleep(7000);
        waitForTextPresent("Videos uploaded successfully");

    } catch (InterruptedException e) {

        e.printStackTrace();
    }
}

From source file:com.photon.phresco.Screens.InvalidJarBase.java

public void addInvalidComponentInDownload(String methodName) {
    if (StringUtils.isEmpty(methodName)) {
        methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        log.info("@testComponentsAddValidDownloadPage::******executing addValidDownloadDownload scenario****");
    }//from   ww w  .ja v a2  s.c  o  m
    try {
        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.COMPONENTS_LINK);
        waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName);
        click();
        Thread.sleep(1000);

        waitForElementPresent(uiConstants.CUSTOMER_DROPDOWN, methodName);
        getXpathWebElement(adminUIConstants.CUSTOMER_DROPDOWN_VALUE).click();
        click();

        waitForTextPresent("Downloads");
        Thread.sleep(20000);
        waitForElementPresent(uiConstants.DOWNLOAD_TAB, methodName);
        element = getXpathWebElement(uiConstants.DOWNLOAD_TAB);
        click();

        Thread.sleep(5000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_BUTTON);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_BUTTON, methodName);
        click();

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_NAME);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_NAME, methodName);
        click();
        Thread.sleep(2000);
        type(adminUIConstants.DOWNLOAD_ADD_NAME_VALUE);

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_DESCRIPTION);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_DESCRIPTION, methodName);
        click();
        type(adminUIConstants.DOWNLOAD_ADD_DESCRIPTION_VALUE);
        Thread.sleep(2000);

        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_TECHNOLGY);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_TECHNOLGY, methodName);
        click();
        Thread.sleep(10000);

        System.out.println("--------------Upload File----------");
        driver.findElement(By.name("file")).sendKeys("D:\\jars\\drupal-maven-plugin-2.0.0.6001-SNAPSHOT.jar");

        Thread.sleep(5000);
        System.out.println("-------------- File-Upload Done---------");
        Thread.sleep(4000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_VERSION);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_VERSION, methodName);
        click();
        type(adminUIConstants.DOWNLOAD_ADD_VERSION_VALUE);

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_GROUPID);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_GROUPID, methodName);
        click();
        type(adminUIConstants.DOWNLOAD_ADD_GROUPID_VALUE);

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_ARTIFACTID);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_ARTIFACTID, methodName);
        click();
        type(adminUIConstants.DOWNLOAD_ADD_ARTIFACTIDID_VALUE);

        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_LICENSE_TYPE);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_LICENSE_TYPE, methodName);
        click();
        selectText(element, adminUIConstants.DOWNLOAD_ADD_LICENSE_TYPE_VALUE);
        click();

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_APPLICATION_PLATFORM);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_APPLICATION_PLATFORM, methodName);
        click();

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_GROUP);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_GROUP, methodName);
        click();
        selectText(element, adminUIConstants.DOWNLOAD_ADD_GROUP_VALUE);
        click();

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_SAVE_BUTTON);
        waitForElementPresent(uiConstants.DOWNLOAD_ADD_SAVE_BUTTON, methodName);
        click();
        //waitForElementPresent(uiConstants.PROJCREATIONSUCCESSMSG,methodName);
        waitForTextPresent(adminUIConstants.TEXT_SUCCESSS_MSG);

        Thread.sleep(2000);
        isTextPresent(adminUIConstants.DOWNLOAD_ADD_NAME_VALUE);

        System.out.println("--------------Recent uploaded Download is ----------"
                + adminUIConstants.DOWNLOAD_ADD_NAME_VALUE);

    }

    catch (Exception e) {

        e.printStackTrace();
    }
}

From source file:com.photon.phresco.Screens.InvalidJarBase.java

public void addValidComponent(String methodName) throws Exception {
    if (StringUtils.isEmpty(methodName)) {
        methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
    }//from w  ww .  j  a va  2  s .co  m
    log.info("@testReusableComponentsAddEmptyComponentPage::******executing addValidComponent scenario****");
    try {
        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.COMPONENTS_LINK);
        waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName);
        click();
        Thread.sleep(1000);

        getXpathWebElement(uiConstants.CUSTOMER_DROPDOWN).click();
        getXpathWebElement(adminUIConstants.CUSTOMER_DROPDOWN_VALUE).click();

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.REASUABLE_COMPONENTS_COMPONENT_TAB);
        waitForElementPresent(uiConstants.REASUABLE_COMPONENTS_COMPONENT_TAB, methodName);
        click();
        Thread.sleep(1000);

        try {

            if (methodName == "testPHPCreateApplicationLayerArchetypesPage"
                    || methodName == "testDrupal6CreateApplicationLayerArchetypesPage"
                    || methodName == "testDrupal7CreateApplicationLayerArchetypesPage"
                    || methodName == "testWordPressCreateApplicationLayerArchetypesPage") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_PHP_TECHNOLOGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testDOTNETCreateApplicationLayerArchetypesPage"
                    || methodName == "testSharePointCreateApplicationLayerArchetypesPage"
                    || methodName == "testSiteCoreCreateApplicationLayerArchetypesPage") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_DOTNET_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testNodejsCreateApplicationLayerArchetypesPage") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_NODEJS_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testJavaStandaloneCreateApplicationLayerArchetypesPage"
                    || methodName == "testJavaWebServiceCreateApplicationLayerArchetypesPage") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_JAVASTANDALONE_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testiPhoneHybridCreateMobileLayerArchetypes"
                    || methodName == "testiphoneNativeCreateMobileLayerArchetypes"
                    || methodName == "testiPhoneLibraryCreateMobileLayerArchetypes"
                    || methodName == "testiPhoneWorkSpaceCreateMobileLayerArchetypes") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_IPHONEHYBRID_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testAndroidHybridCreateMobileLayerArchetypes"
                    || methodName == "testAndroidNativeCreateMobileLayerArchetypes"
                    || methodName == "testAndroidLibraryCreateMobileLayerArchetypes") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_ANDROIDHYBRID_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testWindowsMetroCreateMobileLayerArchetypes"
                    || methodName == "testWindowsPhoneCreateMobileLayerArchetypes") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_WINDOWSMETRO_TECHONOLGY_VALUE).click();
                Thread.sleep(2000);
            }
            if (methodName == "testBlackBerryHybridCreateMobileLayerArchetypes") {
                getXpathWebElement(uiConstants.SELECT_TECHNOLOGY).click();
                getXpathWebElement(adminUIConstants.ADD_PilotProjects_BLACKBERRY_HYBRID_TECHONOLGY_VALUE)
                        .click();
                Thread.sleep(2000);
            }

        } catch (Exception e) {

            e.printStackTrace();
        }

        element = getXpathWebElement(uiConstants.COMPONENTS_ADD_BUTTON);
        waitForElementPresent(uiConstants.COMPONENTS_ADD_BUTTON, methodName);
        click();
        Thread.sleep(1000);

        element = getXpathWebElement(uiConstants.COMPONENTS_NAME);
        waitForElementPresent(uiConstants.COMPONENTS_NAME, methodName);
        click();
        Thread.sleep(1000);
        //type(adminUIConstants.ADD_COMPONENT_NAME_VALUE);
        type(methodName);
        Thread.sleep(2000);

        element = getXpathWebElement(uiConstants.COMPONENTS_DESCRIPTION);
        waitForElementPresent(uiConstants.COMPONENTS_DESCRIPTION, methodName);
        click();
        Thread.sleep(1000);
        type(adminUIConstants.ADD_COMPONENT_DESCRIPTION_VALUE);
        Thread.sleep(2000);

        element = getXpathWebElement(uiConstants.COMPONENTS_HELPTEXT);
        waitForElementPresent(uiConstants.COMPONENTS_HELPTEXT, methodName);
        click();
        Thread.sleep(1000);
        type(adminUIConstants.ADD_COMPONENT_HELPTEXT_VALUE);
        Thread.sleep(2000);

        /*element=getXpathWebElement(uiConstants.COMPONENTS_TECHNOLOGY);
        waitForElementPresent(uiConstants.COMPONENTS_TECHNOLOGY,methodName);
        click();*/
        //Thread.sleep(6000);

        AddingTechnology(methodName);

        Thread.sleep(3000);

        element = getXpathWebElement(uiConstants.COMPONENTS_LICENSE_TYPE);
        waitForElementPresent(uiConstants.COMPONENTS_LICENSE_TYPE, methodName);
        click();
        Thread.sleep(3000);
        type(adminUIConstants.ADD_COMPONENT_LICENSE_TYPE);
        click();
        Thread.sleep(8000);

        System.out.println("--------------Upload File----------");
        driver.findElement(By.name("file")).sendKeys(
                "D:\\Test\\Phresco-Build-2.0.0.32000\\phresco-framework\\tools\\maven\\lib\\aether-impl-1.11.jar");

        Thread.sleep(4000);
        System.out.println("--------------Upload File----------");

        /*Runtime.getRuntime().exec("C://Documents and Settings/srividya_su/Desktop/site_uploadfile.exe");
        Thread.sleep(10000);*/

        //SELECT DEPENDENCY CURRENTLY NOT WORKING

        /*element=getXpathWebElement(uiConstants.COMPONENTS_SELECT_DEPENDENCY);
        waitForElementPresent(uiConstants.COMPONENTS_SELECT_DEPENDENCY,methodName);
        click();
                
        Thread.sleep(2000);
        element=getXpathWebElement(uiConstants.COMPONENTS_DEPENDENCY_OK_BUTTON);
        waitForElementPresent(uiConstants.COMPONENTS_DEPENDENCY_OK_BUTTON,methodName);
        click();*/
        Thread.sleep(1000);

        element = getXpathWebElement(uiConstants.COMPONENTS_SAVE_BUTTON);
        waitForElementPresent(uiConstants.COMPONENTS_SAVE_BUTTON, methodName);
        click();
        //waitForElementPresent(uiConstants.PROJCREATIONSUCCESSMSG,methodName);
        waitForTextPresent(adminUIConstants.TEXT_SUCCESSS_MSG);

        /*isTextPresent(adminUIConstants.EMPTY_ADD_COMPONENT_UPLOAD_FILE_MSG);
         Thread.sleep(1000);
                
        element=getXpathWebElement(uiConstants.COMPONENTS_CANCEL_BUTTON);
        waitForElementPresent(uiConstants.COMPONENTS_CANCEL_BUTTON, methodName);
        click();
        Thread.sleep(1000);*/

    } catch (InterruptedException e) {

        e.printStackTrace();
    }
}

From source file:com.photon.phresco.Screens.InvalidJarBase.java

public void createWebLayerArchetypes(String methodName) {
    if (StringUtils.isEmpty(methodName)) {
        methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        log.info("@testAdminCustomerPage::******executing createWebLayerArchetypes scenario****");
    }/*from ww w  .j  a v  a 2 s.c o  m*/
    try {

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.COMPONENTS_LINK);
        waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName);
        click();

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_TAB);
        waitForElementPresent(uiConstants.ARCHETYPES_TAB, methodName);
        click();

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_CREATE_BUTTON);
        waitForElementPresent(uiConstants.ARCHETYPES_CREATE_BUTTON, methodName);
        click();

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_NAME);
        waitForElementPresent(uiConstants.ARCHETYPES_NAME, methodName);
        click();
        //type(adminUIConstants.CREATE_WEB_LAYER_ARCHETYPES_NAME_VALUE);
        type(methodName);

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_DESCRIPTION);
        waitForElementPresent(uiConstants.ARCHETYPES_DESCRIPTION, methodName);
        click();
        type(adminUIConstants.CREATE_WEB_LAYER_ARCHETYPES_DESCRIPTION_VALUE);

        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_TECHNOLOGY_VERSION);
        waitForElementPresent(uiConstants.ARCHETYPES_TECHNOLOGY_VERSION, methodName);
        click();
        type(adminUIConstants.CREATE_WEB_LAYER_ARCHETYPES_TECHNOLGY_VERSION_VALUE);

        Thread.sleep(2000);
        /*element=getXpathWebElement(uiConstants.ARCHETYPES_VERSION_COMMENT);
        waitForElementPresent(uiConstants.ARCHETYPES_VERSION_COMMENT, methodName);
        click();
        type(adminUIConstants.CREATE_WEB_LAYER_ARCHETYPES_VERSION_COMMENT_VALUE);
        */
        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_APPLICATION_TYPE);
        waitForElementPresent(uiConstants.ARCHETYPES_APPLICATION_TYPE, methodName);
        click();
        type(adminUIConstants.CREATE_WEB_LAYER_ARCHETYPES_APPLICATION_TYPE_VALUE);
        click();
        Thread.sleep(2000);

        element = getXpathWebElement(uiConstants.ARCHETYPES_APPLICATION_GROUP_TYPE);
        waitForElementPresent(uiConstants.ARCHETYPES_APPLICATION_GROUP_TYPE, methodName);
        click();
        Thread.sleep(2000);

        ArcheTypeAddingTechnology(methodName);

        System.out.println("--------------Upload archeytype File----------");
        driver.findElement(By.name("file"))
                .sendKeys("C:\\Documents and Settings\\srividya_su\\Desktop\\archetype.jar");

        Thread.sleep(4000);
        System.out.println("--------------Upload archeytype File----------");

        /*element=getXpathWebElement(uiConstants.ARCHETYPES_UPLOAD_JAR);
        waitForElementPresent(uiConstants.ARCHETYPES_UPLOAD_JAR, methodName);
        click();
                
        Thread.sleep(2000);*/
        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_APPLICATION_FEATURES_ALL);
        waitForElementPresent(uiConstants.ARCHETYPES_APPLICATION_FEATURES_ALL, methodName);
        click();
        Thread.sleep(2000);
        Thread.sleep(2000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_APPLICABLE_REPORTS_ALL);
        waitForElementPresent(uiConstants.ARCHETYPES_APPLICABLE_REPORTS_ALL, methodName);
        click();

        Thread.sleep(4000);
        element = getXpathWebElement(uiConstants.ARCHETYPES_SAVE_BUTTON);
        waitForElementPresent(uiConstants.ARCHETYPES_SAVE_BUTTON, methodName);
        click();
        //waitForElementPresent(uiConstants.PROJCREATIONSUCCESSMSG,methodName);
        waitForTextPresent(adminUIConstants.TEXT_SUCCESSS_MSG);

    }

    catch (Exception e) {

        e.printStackTrace();
    }
}