List of usage examples for org.openqa.selenium By linkText
public static By linkText(String linkText)
From source file:com.vmware.gemfire.tools.pulse.tests.PulseAbstractTest.java
License:Apache License
protected void searchByLinkAndClick(String linkText) { WebElement element = By.linkText(linkText).findElement(driver); assertNotNull(element); element.click(); }
From source file:com.vmware.gemfire.tools.pulse.tests.PulseAbstractTest.java
License:Apache License
@Ignore("WIP") @Test//w w w.ja v a2 s. co m public void testDataBrowser() { driver.findElement(By.linkText("Data Browser")).click(); // WebElement dataBrowserLabel = driver.findElement(By.xpath("")); WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//label[text()='Data Browser']")))); // Verify all elements must be displayed on data browser screen assertTrue(driver.findElement(By.xpath("//a[text()='Data Regions']")).isDisplayed()); assertTrue(driver.findElement(By.id("linkColocatedRegions")).isDisplayed()); assertTrue(driver.findElement(By.linkText("All Regions")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//a[text()='Region Members']")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//a[text()='Queries']")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//label[text()='Query Editor']")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//label[text()='Result']")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//input[@value='Export Result']")).isDisplayed()); assertTrue(driver.findElement(By.id("btnExecuteQuery")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//input[@value='Clear']")).isDisplayed()); assertTrue(driver.findElement(By.id("dataBrowserQueryText")).isDisplayed()); assertTrue(driver.findElement(By.id("historyIcon")).isDisplayed()); //Actual query execution driver.findElement(By.id("dataBrowserQueryText")).sendKeys("Query1"); // Assert data regions are displayed assertTrue(driver.findElement(By.id("treeDemo_1")).isDisplayed()); }
From source file:com.vmware.gemfire.tools.pulse.tests.PulseBaseTest.java
License:Apache License
public void verifyElementPresentByLinkText(String lnkText) { WebDriverWait wait = new WebDriverWait(driver, maxWaitTime, 500); wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.linkText(lnkText))); }
From source file:com.vmware.gemfire.tools.pulse.tests.PulseTest.java
License:Apache License
@Ignore("WIP") @Test/*from www . ja va 2 s. c o m*/ public void testDataBrowser() { driver.findElement(By.linkText("Data Browser")).click(); // WebElement dataBrowserLabel = driver.findElement(By.xpath("")); WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//label[text()='Data Browser']")))); // Verify all elements must be displayed on data browser screen Assert.assertTrue(driver.findElement(By.xpath("//a[text()='Data Regions']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.id("linkColocatedRegions")).isDisplayed()); Assert.assertTrue(driver.findElement(By.linkText("All Regions")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//a[text()='Region Members']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//a[text()='Queries']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//label[text()='Query Editor']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//label[text()='Result']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//input[@value='Export Result']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.id("btnExecuteQuery")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//input[@value='Clear']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.id("dataBrowserQueryText")).isDisplayed()); Assert.assertTrue(driver.findElement(By.id("historyIcon")).isDisplayed()); //Actual query execution driver.findElement(By.id("dataBrowserQueryText")).sendKeys("Query1"); // Assert data regions are displayed Assert.assertTrue(driver.findElement(By.id("treeDemo_1")).isDisplayed()); }
From source file:com.worldline.easycukes.selenium.stepdefs.SeleniumAbstractStepdefs.java
License:Open Source License
/** * TODO//from w w w . ja v a2s . c o m * * @param selector * @param pValue * @return * @throws Exception */ protected By getSelector(String selector, String pValue) throws Exception { String value = DataInjector.injectData(pValue); By by = null; if (selector.equalsIgnoreCase("id")) by = By.id(value); else if (selector.equalsIgnoreCase("name")) by = By.name(value); else if (selector.equalsIgnoreCase("class")) by = By.className(value); else if (selector.equalsIgnoreCase("css")) by = By.cssSelector(value); else if (selector.equalsIgnoreCase("link")) by = By.linkText(value); else if (selector.equalsIgnoreCase("tag")) by = By.tagName(value); else if (selector.equalsIgnoreCase("xpath")) by = By.xpath(value); if (by == null) { log.error("Unknown type of selector : " + selector); throw new Exception("Unknown type of selector : " + selector); } return by; }
From source file:com.xyxy.platform.examples.showcase.functional.account.UserManagerFT.java
License:Apache License
@Test @Category(Smoke.class) public void list() { s.open("/");/*from w w w. j a v a2 s.c om*/ s.click(By.linkText("???")); loginAsAdminIfNecessary(); s.waitForTitleContains("?"); WebElement table = s.findElement(By.id("contentTable")); assertThat(s.getTable(table, 0, 1)).isEqualTo("? "); }
From source file:com.xyxy.platform.examples.showcase.functional.account.UserManagerFT.java
License:Apache License
@Test @Category(Smoke.class) public void editUser() { s.open("/");//from w ww . j a va 2s . c o m s.click(By.linkText("???")); loginAsAdminIfNecessary(); 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.xyxy.platform.examples.showcase.functional.ajax.AjaxFT.java
License:Apache License
@Test public void mashup() { s.open("/");/*from www.ja v a 2 s.c o m*/ s.click(By.linkText("Web")); s.click(By.linkText("??Mashup")); s.click(By.xpath("//input[@value='?']")); s.waitForVisible(By.id("mashupContent")); assertThat(s.getText(By.id("mashupContent"))).isEqualTo("?"); }
From source file:com.zutubi.pulse.acceptance.CloneAcceptanceTest.java
License:Apache License
public void testCloneProjectHierarchyWithChild() throws Exception { String parentName = random + "-parent"; String childName = random + "-child"; ProjectHierarchyPage hierarchyPage = setupHierarchy(parentName, childName); hierarchyPage.clickClone();//from w w w . ja v a 2s . co m CloneForm cloneForm = getBrowser().createForm(CloneForm.class, false); cloneForm.addDescendant(childName); cloneForm.waitFor(); String parentCloneName = parentName + CLONE_PROPERTY_NAME; String childCloneName = childName + CLONE_PROPERTY_NAME; cloneForm.cloneFormElements(parentCloneName, "true", childCloneName); ProjectHierarchyPage cloneHierarchyPage = getBrowser().createPage(ProjectHierarchyPage.class, parentCloneName, true); cloneHierarchyPage.waitFor(); assertEquals(asList(childCloneName), rpcClient.RemoteApi.getTemplateChildren( PathUtils.getPath(MasterConfigurationRegistry.PROJECTS_SCOPE, parentCloneName))); assertTrue(hierarchyPage.isTreeItemPresent(parentCloneName)); assertFalse(hierarchyPage.isTreeItemPresent(childCloneName)); hierarchyPage.expandTreeItem(parentCloneName); getBrowser().waitForElement(By.linkText(childCloneName)); }
From source file:com.zutubi.pulse.acceptance.CloneAcceptanceTest.java
License:Apache License
public void testSmartCloneProjectHierarchyWithChild() throws Exception { String parentName = random + "-parent"; String childName = random + "-child"; ProjectHierarchyPage hierarchyPage = setupHierarchy(parentName, childName); hierarchyPage.clickSmartClone();//from w w w.j av a 2 s . com CloneForm cloneForm = getBrowser().createForm(CloneForm.class, true); cloneForm.addDescendant(childName); cloneForm.waitFor(); String parentTemplateName = parentName + PARENT_PROPERTY_NAME; String parentCloneName = parentName + CLONE_PROPERTY_NAME; String childCloneName = childName + CLONE_PROPERTY_NAME; cloneForm.cloneFormElements(parentCloneName, parentTemplateName, "true", childCloneName); ProjectHierarchyPage cloneHierarchyPage = getBrowser().createPage(ProjectHierarchyPage.class, parentCloneName, true); cloneHierarchyPage.waitFor(); assertEquals(asList(childCloneName), rpcClient.RemoteApi.getTemplateChildren( PathUtils.getPath(MasterConfigurationRegistry.PROJECTS_SCOPE, parentCloneName))); assertTrue(hierarchyPage.isTreeItemPresent(parentTemplateName)); assertTrue(hierarchyPage.isTreeItemPresent(parentCloneName)); assertFalse(hierarchyPage.isTreeItemPresent(childCloneName)); hierarchyPage.expandTreeItem(parentCloneName); getBrowser().waitForElement(By.linkText(childCloneName)); }