List of usage examples for org.openqa.selenium WebElement findElements
@Override List<WebElement> findElements(By by);
From source file:com.dukescript.api.selenium.FindsByTest.java
License:Open Source License
@Test public void Element_findElementsByLinkText() { WebElement links = driver.findElement(By.id("links")); List<WebElement> findElements = links.findElements(By.linkText("Text of link")); Assert.assertEquals(1, findElements.size()); findElements = links.findElements(By.linkText("Other link")); Assert.assertEquals(2, findElements.size()); }
From source file:com.dukescript.api.selenium.FindsByTest.java
License:Open Source License
@Test public void Element_findElementsByPartialLinkText() { WebElement links = driver.findElement(By.id("links")); List<WebElement> findElements = links.findElements(By.partialLinkText("Text")); Assert.assertEquals(2, findElements.size()); findElements = links.findElements(By.partialLinkText("Other link")); Assert.assertEquals(2, findElements.size()); findElements = links.findElements(By.partialLinkText("link")); Assert.assertEquals(4, findElements.size()); }
From source file:com.dukescript.api.selenium.FindsByTest.java
License:Open Source License
@Test public void Element_findElementsByName() { WebElement parent = driver.findElement(By.id("form")); List<WebElement> found = parent.findElements(By.name("text")); Assert.assertEquals(1, found.size()); }
From source file:com.dukescript.api.selenium.FindsByTest.java
License:Open Source License
@Test public void Element_findElementsByTagName() { WebElement parent = driver.findElement(By.id("form")); List<WebElement> found = parent.findElements(By.tagName("input")); Assert.assertEquals(2, found.size()); }
From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansQuestSteps.java
@When("^Click on the Phisician icon on the LabClient list page for Quest lab$") public void click_on_the_Phisician_icon_on_the_LabClient_list_page_for_Quest_lab() throws Throwable { Thread.sleep(2000);/*from w w w .ja v a2 s. co m*/ WebElement table = driver.findElement(By.id("example")); List<WebElement> allRows = table.findElements(By.tagName("tr")); loop: { for (WebElement row : allRows) { List<WebElement> cells = row.findElements(By.xpath("./*")); for (WebElement cell : cells) { String cellText = cell.getText(); if (cellText.equals(LAB_CLIENT)) { WebElement icon = row.findElement(By.cssSelector(".fa.fa-user-md.fa-2x")); icon.click(); break loop; } } } } Thread.sleep(2000); }
From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java
@When("^Click on the Phisician icon on the LabClient list page for West lab$") public void click_on_the_Phisician_icon_on_the_LabClient_list_page_for_West_lab() throws Throwable { Thread.sleep(2000);/* w w w .j a v a 2 s . c o m*/ WebElement table = driver.findElement(By.id("example")); List<WebElement> allRows = table.findElements(By.tagName("tr")); loop: { for (WebElement row : allRows) { List<WebElement> cells = row.findElements(By.xpath("./*")); for (WebElement cell : cells) { String cellText = cell.getText(); if (cellText.equals(LAB_CLIENT)) { WebElement icon = row.findElement(By.cssSelector(".fa.fa-user-md.fa-2x")); icon.click(); break loop; } } } } Thread.sleep(2000); }
From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java
@When("^Select 'Edit' icon next to 'Angelina' physician$") public void select_Edit_icon_next_to_Angelina_physician() throws Throwable { Thread.sleep(2000);/*from ww w . jav a 2 s .c om*/ WebElement table = driver.findElement(By.id("example")); List<WebElement> allRows = table.findElements(By.tagName("tr")); loop: { for (WebElement row : allRows) { List<WebElement> cells = row.findElements(By.xpath("./*")); for (WebElement cell : cells) { String cellText = cell.getText(); if (cellText.equals("Angelia")) { WebElement icon = row.findElement(By.cssSelector(".fa.fa-pencil-square-o.fa-2x")); icon.click(); break loop; } } } } Thread.sleep(2000); }
From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java
@When("^Click on the Phisician icon on the LabClient list page for Zest lab$") public void click_on_the_Phisician_icon_on_the_LabClient_list_page_for_Zest_lab() throws Throwable { Thread.sleep(2000);/*w w w .j a v a 2 s .c o m*/ WebElement table = driver.findElement(By.id("example")); List<WebElement> allRows = table.findElements(By.tagName("tr")); loop: { for (WebElement row : allRows) { List<WebElement> cells = row.findElements(By.xpath("./*")); for (WebElement cell : cells) { String cellText = cell.getText(); if (cellText.equals(LAB_CLIENT)) { WebElement icon = row.findElement(By.cssSelector(".fa.fa-user-md.fa-2x")); icon.click(); break loop; } } } } Thread.sleep(2000); }
From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansWestSteps.java
@When("^Select 'Edit' icon next to 'BradLemon' physician$") public void select_Edit_icon_next_to_BradLemon_physician() throws Throwable { Thread.sleep(2000);//from w ww . j a va 2 s . co m WebElement table = driver.findElement(By.id("example")); List<WebElement> allRows = table.findElements(By.tagName("tr")); loop: { for (WebElement row : allRows) { List<WebElement> cells = row.findElements(By.xpath("./*")); for (WebElement cell : cells) { String cellText = cell.getText(); if (cellText.equals("BradLemon")) { WebElement icon = row.findElement(By.cssSelector(".fa.fa-pencil-square-o.fa-2x")); icon.click(); break loop; } } } } Thread.sleep(2000); }
From source file:com.easytox.automation.steps.AuditAndUserLogImpl.java
@Then("^Records should be displayed based on the ascending order of the selected column$") public void check_ascending_order() { while (true) { try {// w w w .j av a 2s.c o m WebElement table = driver.findElement(By.id(TABLE_LOCATOR)); List<WebElement> allRows = table.findElements(By.tagName(ROWS_LOCATOR)); int j; j = getSortColumn(allRows, 8); String temp = allRows.get(1).findElements(By.xpath(CELLS_LOCATOR)).get(j).getText(); checkData(temp, allRows, 2, j); break; } catch (StaleElementReferenceException ex) { System.out.println("element is not attached to the page document"); } } }