List of usage examples for org.openqa.selenium By name
public static By name(String name)
From source file:com.photon.phresco.Screens.InvalidJarBase.java
public void createApplicationLayerArchetypes(String methodName) { if (StringUtils.isEmpty(methodName)) { methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); log.info("@testAdminCustomerPage::******executing createApplicationLayerArchetypes scenario****"); }//from w w w. j ava2 s . c o m try { Thread.sleep(2000); element = getXpathWebElement(uiConstants.COMPONENTS_LINK); waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName); click(); Thread.sleep(1000); element = getXpathWebElement(uiConstants.CUSTOMER_DROPDOWN); selectText(element, adminUIConstants.CUSTOMER_DROPDOWN_VALUE); 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_APPLICATION_LAYER_ARCHETYPES_NAME_VALUE); type(methodName); Thread.sleep(2000); element = getXpathWebElement(uiConstants.ARCHETYPES_DESCRIPTION); waitForElementPresent(uiConstants.ARCHETYPES_DESCRIPTION, methodName); click(); type(adminUIConstants.CREATE_APPLICATION_LAYER_ARCHETYPES_DESCRIPTION_VALUE); Thread.sleep(2000); element = getXpathWebElement(uiConstants.ARCHETYPES_TECHNOLOGY_VERSION); waitForElementPresent(uiConstants.ARCHETYPES_TECHNOLOGY_VERSION, methodName); click(); type(adminUIConstants.CREATE_APPLICATION_LAYER_ARCHETYPES_TECHNOLGY_VERSION_VALUE); Thread.sleep(2000); /*element=getXpathWebElement(uiConstants.ARCHETYPES_VERSION_COMMENT); waitForElementPresent(uiConstants.ARCHETYPES_VERSION_COMMENT, methodName); click(); type(adminUIConstants.CREATE_APPLICATION_LAYER_ARCHETYPES_VERSION_COMMENT_VALUE); Thread.sleep(2000);*/ element = getXpathWebElement(uiConstants.ARCHETYPES_APPLICATION_TYPE); waitForElementPresent(uiConstants.ARCHETYPES_APPLICATION_TYPE, methodName); click(); Thread.sleep(2000); type(adminUIConstants.CREATE_APPLICATION_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----------"); /*Runtime.getRuntime().exec("C://Documents and Settings/srividya_su/Desktop/archeytype_uploadfile.exe"); Thread.sleep(4000);*/ /*element=getXpathWebElement(uiConstants.ARCHETYPES_UPLOAD_JAR); waitForElementPresent(uiConstants.ARCHETYPES_UPLOAD_JAR, methodName); click();*/ /*Thread.sleep(2000); element=getXpathWebElement(uiConstants.ARCHETYPES_UPLOAD_PLUGIN_JAR); waitForElementPresent(uiConstants.ARCHETYPES_UPLOAD_PLUGIN_JAR, methodName); click();*/ 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(); } }
From source file:com.photon.phresco.Screens.InvalidJarBase.java
public void createMobileLayerArchetypes(String methodName) { if (StringUtils.isEmpty(methodName)) { methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); log.info("@testAdminCustomerPage::******executing createMobileLayerArchetypes scenario****"); }//from w w w . j ava2 s. co m try { Thread.sleep(2000); element = getXpathWebElement(uiConstants.COMPONENTS_LINK); waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName); click(); Thread.sleep(1000); 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_MOBILE_LAYER_ARCHETYPES_NAME_VALUE); type(methodName); Thread.sleep(2000); element = getXpathWebElement(uiConstants.ARCHETYPES_DESCRIPTION); waitForElementPresent(uiConstants.ARCHETYPES_DESCRIPTION, methodName); click(); type(adminUIConstants.CREATE_MOBILE_LAYER_ARCHETYPES_DESCRIPTION_VALUE); Thread.sleep(2000); element = getXpathWebElement(uiConstants.ARCHETYPES_TECHNOLOGY_VERSION); waitForElementPresent(uiConstants.ARCHETYPES_TECHNOLOGY_VERSION, methodName); click(); type(adminUIConstants.CREATE_MOBILE_LAYER_ARCHETYPES_TECHNOLGY_VERSION_VALUE); Thread.sleep(2000); /*element=getXpathWebElement(uiConstants.ARCHETYPES_VERSION_COMMENT); waitForElementPresent(uiConstants.ARCHETYPES_VERSION_COMMENT, methodName); click(); type(adminUIConstants.CREATE_MOBILE_LAYER_ARCHETYPES_VERSION_COMMENT_VALUE); Thread.sleep(2000);*/ element = getXpathWebElement(uiConstants.ARCHETYPES_APPLICATION_TYPE); waitForElementPresent(uiConstants.ARCHETYPES_APPLICATION_TYPE, methodName); click(); Thread.sleep(2000); type(adminUIConstants.CREATE_MOBILE_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); Thread.sleep(4000); 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----------"); /*Runtime.getRuntime().exec("C://Documents and Settings/srividya_su/Desktop/archeytype_uploadfile.exe"); Thread.sleep(4000);*/ /*element=getXpathWebElement(uiConstants.ARCHETYPES_UPLOAD_JAR); waitForElementPresent(uiConstants.ARCHETYPES_UPLOAD_JAR, methodName); click();*/ /*Thread.sleep(2000); element=getXpathWebElement(uiConstants.ARCHETYPES_UPLOAD_PLUGIN_JAR); waitForElementPresent(uiConstants.ARCHETYPES_UPLOAD_PLUGIN_JAR, methodName); click();*/ 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(); } }
From source file:com.photon.phresco.Screens.InvalidJarBase.java
public void addValidPilotProject(String methodName) { if (StringUtils.isEmpty(methodName)) { methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); log.info("@testComponentsAddValidPilotProjectsPage::******executing addValidPilotProject scenario****"); }/*from ww w.j av a 2 s.c o m*/ try { Thread.sleep(2000); element = getXpathWebElement(uiConstants.COMPONENTS_LINK); waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName); click(); Thread.sleep(1000); element = getXpathWebElement(uiConstants.CUSTOMER_DROPDOWN); selectText(element, adminUIConstants.CUSTOMER_DROPDOWN_VALUE); Thread.sleep(2000); element = getXpathWebElement(uiConstants.PILOT_PROJECT_TAB); waitForElementPresent(uiConstants.PILOT_PROJECT_TAB, methodName); click(); Thread.sleep(2000); element = getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_BUTTON); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_BUTTON, methodName); click(); Thread.sleep(2000); element = getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_NAME); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_NAME, methodName); click(); Thread.sleep(2000); //type(adminUIConstants.PILOT_PROJECT_ADD_NAME_VALUE); type(methodName); Thread.sleep(2000); element = getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_DESCRIPTION); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_DESCRIPTION, methodName); click(); Thread.sleep(2000); type(adminUIConstants.PILOT_PROJECT_ADD_DESCRIPTION_VALUE); Thread.sleep(2000); /*element=getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_VERSION); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_VERSION, methodName); click(); Thread.sleep(2000); type(adminUIConstants.PILOT_PROJECT_ADD_VERSION_VALUE);*/ /* Thread.sleep(2000); element=getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_TECHNOLOGY); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_TECHNOLOGY, methodName); click();*/ Thread.sleep(3000); PilotProjectsAddingTechnology(methodName); Thread.sleep(3000); System.out.println("--------------Upload Zip File----------"); driver.findElement(By.name("file")) .sendKeys("C:\\Documents and Settings\\srividya_su\\Desktop\\zipfolder.zip"); Thread.sleep(4000); System.out.println("--------------Upload Zip File----------"); /*Runtime.getRuntime().exec("C://Documents and Settings/srividya_su/Desktop/zip_uploadfile.exe"); Thread.sleep(4000);*/ Thread.sleep(1000); element = getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_GROUP_ID); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_GROUP_ID, methodName); click(); type(adminUIConstants.PILOT_PROJECT_ADD_GROUP_ID_VALUE); Thread.sleep(1000); Thread.sleep(1000); element = getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_ARTIFACT_ID); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_ARTIFACT_ID, methodName); click(); type(adminUIConstants.PILOT_PROJECT_ADD_ARTIFACT_VALUE); Thread.sleep(1000); Thread.sleep(1000); element = getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_VERSION_PROJECT); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_VERSION_PROJECT, methodName); click(); type(adminUIConstants.PILOT_PROJECT_ADD_VERSION_PROJECT_VALUE); Thread.sleep(1000); Thread.sleep(1000); element = getXpathWebElement(uiConstants.PILOT_PROJECT_ADD_SAVE_BUTTON); waitForElementPresent(uiConstants.PILOT_PROJECT_ADD_SAVE_BUTTON, methodName); click(); //waitForElementPresent(uiConstants.PROJCREATIONSUCCESSMSG,methodName); waitForTextPresent(adminUIConstants.TEXT_SUCCESSS_MSG); //isTextPresent(adminUIConstants.PILOT_PROJECT_EMPTY_PROJECT_SOURCE_ERROR_MSG); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.photon.phresco.Screens.InvalidJarBase.java
public void addValidDownload(String methodName) { if (StringUtils.isEmpty(methodName)) { methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); log.info("@testComponentsAddValidDownloadPage::******executing addValidDownloadDownload scenario****"); }/*from ww w. j a v a 2s . co m*/ try { Thread.sleep(2000); element = getXpathWebElement(uiConstants.COMPONENTS_LINK); waitForElementPresent(uiConstants.COMPONENTS_LINK, methodName); click(); element = getXpathWebElement(uiConstants.CUSTOMER_DROPDOWN); selectText(element, adminUIConstants.CUSTOMER_DROPDOWN_VALUE); Thread.sleep(2000); element = getXpathWebElement(uiConstants.DOWNLOAD_TAB); waitForElementPresent(uiConstants.DOWNLOAD_TAB, methodName); click(); Thread.sleep(2000); 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(); clear(); Thread.sleep(2000); //type(adminUIConstants.DOWNLOAD_ADD_NAME_VALUE); type(methodName); Thread.sleep(2000); element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_DESCRIPTION); waitForElementPresent(uiConstants.DOWNLOAD_ADD_DESCRIPTION, methodName); click(); Thread.sleep(2000); type(adminUIConstants.DOWNLOAD_ADD_DESCRIPTION_VALUE); Thread.sleep(2000); Thread.sleep(2000); element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_TECHNOLGY); waitForElementPresent(uiConstants.DOWNLOAD_ADD_TECHNOLGY, methodName); click(); // AddingTechnology(methodName); Thread.sleep(2000); 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(2000); element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_VERSION); waitForElementPresent(uiConstants.DOWNLOAD_ADD_VERSION, methodName); click(); type(adminUIConstants.DOWNLOAD_ADD_VERSION_VALUE); click(); Thread.sleep(2000); element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_GROUPID); waitForElementPresent(uiConstants.DOWNLOAD_ADD_GROUPID, methodName); click(); type(adminUIConstants.DOWNLOAD_ADD_GROUPID_VALUE); click(); Thread.sleep(2000); element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_ARTIFACTID); waitForElementPresent(uiConstants.DOWNLOAD_ADD_ARTIFACTID, methodName); click(); type(adminUIConstants.DOWNLOAD_ADD_ARTIFACTIDID_VALUE); click(); element = getXpathWebElement(uiConstants.DOWNLOAD_ADD_LICENSE_TYPE); waitForElementPresent(uiConstants.DOWNLOAD_ADD_LICENSE_TYPE, methodName); click(); type(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(); type(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); element=getXpathWebElement(uiConstants.DOWNLOAD_ADD_CANCEL_BUTTON); waitForElementPresent(uiConstants.DOWNLOAD_ADD_CANCEL_BUTTON, methodName); click();*/ } catch (Exception e) { e.printStackTrace(); } }
From source file:com.photon.phresco.Screens.WebDriverBaseScreen.java
License:Apache License
public void accept() throws InterruptedException { // String parentWindowHandle = driver.getWindowHandle(); // save the current window handle. WebDriver popup = null;/*from w w w . j a va2 s. c o m*/ //String windowname=driver.getWindowHandle(); Set<String> windowname = driver.getWindowHandles(); Iterator<String> window = windowname.iterator(); while (window.hasNext()) { String windowHandle = window.next(); popup = driver.switchTo().window(windowHandle); // driver.switchTo().defaultContent().switchTo().frame("windowHandle"); System.out.println("------------------POP-UP WINDOW NAME---->" + popup.getTitle().toString()); if (popup.getTitle().toString().equalsIgnoreCase("")) { popup.findElement(By.name("OK")).click(); Thread.sleep(5000); break; } } }
From source file:com.ppcxy.cyfm.showcase.functional.account.UserManagerFT.java
License:Apache License
@Test @Category(Smoke.class) public void editUser() { s.open("/manage"); loginAsAdminIfNecessary();//from w w w . java 2s .co m s.getDriver().switchTo().frame("leftFrame"); s.click(By.linkText("?")); s.getDriver().switchTo().defaultContent(); s.waitForCondition(ExpectedConditions.frameToBeAvailableAndSwitchToIt("rightFrame"), Selenium2.DEFAULT_WAIT_TIME); s.click(By.id("editLink-user")); // ?? s.type(By.name("name"), "user_foo"); s.check(By.id("status2")); s.click(By.id("submit_btn")); // ??, ? s.click(By.id("editLink-user")); assertThat(s.getValue(By.name("name"))).isEqualTo("user_foo"); assertThat(s.isChecked(By.id("status2"))).isTrue(); // ?? s.type(By.name("name"), "user"); s.check(By.id("status1")); s.click(By.id("submit_btn")); }
From source file:com.ppcxy.cyfm.showcase.functional.account.UserManagerFT.java
License:Apache License
private void loginAsAdminIfNecessary() { // ????//from ww w . java 2 s . c om if (s.getTitle().contains("")) { s.type(By.name("username"), "admin"); s.type(By.name("password"), "admin"); s.click(By.id("submit_btn")); } }
From source file:com.ppcxy.cyfm.showcase.functional.ajax.AjaxFT.java
License:Apache License
private void loginAsAdminIfNecessary() { // ????/*w w w . jav a2 s . c o m*/ if (s.getTitle().contains("")) { s.type(By.name("username"), "user"); s.type(By.name("password"), "user"); s.click(By.id("submit_btn")); } }
From source file:com.Priyanka.junitProgramsTests.alertNewWindow.java
@Test public void switchBackAndForthWindows() { driver.navigate().to("https://hangouts.google.com/"); driver.findElement(By.cssSelector("[aria-label='Start video call']")).click(); String parentWindow = driver.getWindowHandle(); for (String windowHandle : driver.getWindowHandles()) { if (!windowHandle.equals(parentWindow)) { driver.switchTo().window(windowHandle); }//w w w . j av a 2s.c o m } Assert.assertTrue(driver.getCurrentUrl().contains("https://accounts.google.com/ServiceLogin")); driver.findElement(By.name("Email")).sendKeys("priyankamg.test"); driver.findElement(By.cssSelector("#next")).click(); WebDriverWait wait = new WebDriverWait(driver, 5); wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#Passwd"))); driver.findElement(By.xpath("//input[@id='PersistentCookie']")).click(); driver.findElement(By.name("Passwd")).sendKeys("karu5%99"); driver.findElement(By.cssSelector("#signIn")).click(); driver.close(); driver.switchTo().window(parentWindow); }
From source file:com.provenir.automation.framework.helper.AdminPage.java
public String getRoles() { WebElement ele = driver.findElement(By.name("securityCd")); String s = ele.getAttribute("name"); System.out.println("***********" + s); return s;/*from w ww. j a va 2s .co m*/ }