List of usage examples for org.openqa.selenium WebElement getText
String getText();
From source file:com.dukescript.api.selenium.FindsByTest.java
License:Open Source License
@Test public void Element_findByPartialLinkText() { WebElement links = driver.findElement(By.id("links")); WebElement element = links.findElement(By.partialLinkText("Text")); Assert.assertEquals("Text of link", element.getText()); }
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 ww . ja v a 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(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);//from 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 . j a va 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("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);/* ww w . j a v a 2s . com*/ 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 . ja va 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("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("^Lab Admin should be created successfully and displayed in User List$") public void lab_admin_should_be_created_successfully() { WebElement element = MyWebDriverUtils.findPresenceElement(driver, DANGER_LOCATOR, LocatorType.CSS); if (element != null) { Assert.assertEquals(element.getText(), LIMIT_EXCEEDED); MyWebDriverUtils.checkCurrentUrl(driver, USER_SAVE_PAGE_URL); return;/*from w w w . java 2 s. co m*/ } MyWebDriverUtils.checkWidgetCaption(driver, SUCCESS_LOCATOR, LocatorType.CSS, "User " + User.userName + " Created Sucessfully"); MyWebDriverUtils.checkCurrentUrl(driver, USER_SAVE_PAGE_URL); List<WebElement> cells = MyWebDriverUtils.getCells(driver, TABLE_LOCATOR, LocatorType.ID, -1, 12); if (cells != null && cells.size() == 12) { Assert.assertEquals(cells.get(1).getText(), User.userName); Assert.assertEquals(cells.get(2).getText(), User.FIRST_NAME + " " + User.LAST_NAME); Assert.assertEquals(cells.get(4).getText(), User.EMAIL); Assert.assertEquals(cells.get(5).getText(), User.ROLE); Assert.assertEquals(cells.get(3).getText(), User.PHONE_NUMBER_VIEW); } else { Assert.fail("cells is null"); } }
From source file:com.easytox.automation.steps.AuditAndUserLogImpl.java
@Then("^labuserone should be added to the user list$") public void user_should_be_added_to_the_user_list() { WebElement element = MyWebDriverUtils.findPresenceElement(driver, DANGER_LOCATOR, LocatorType.CSS); if (element != null) { Assert.assertEquals(element.getText(), LIMIT_EXCEEDED); MyWebDriverUtils.checkCurrentUrl(driver, USER_LIST_URL); }//w w w .jav a 2 s. co m }
From source file:com.easytox.automation.steps.AuditAndUserLogImpl.java
@Then("^'(.*)' and '(.*)' values should be displayed$") public void check_values(String firstValue, String SecondValue) { int i = 0;//from ww w.j av a 2 s. c o m int j = 0; if (labClientOptions != null) { for (WebElement option : labClientOptions) { if (option.getText().equals(firstValue)) { i++; } if (option.getText().equals(SecondValue)) { j++; } } Assert.assertTrue(i > 0); Assert.assertTrue(j > 0); } else { Assert.fail("labClientOptions is null!"); } }
From source file:com.easytox.automation.steps.AuditAndUserLogImpl.java
@Then("^No other values should be displayed in the Lab Client drop down$") public void no_other_values() { if (labClientOptions != null) { for (WebElement option : labClientOptions) { String text = option.getText(); if (!text.equals("SLabClientOne") && !text.equals("SLabClientTwo") && !text.equals("Select Lab Client")) { Assert.fail(text + " is other value in Lab Client Drop Down"); }//from ww w . j av a 2 s . co m } } else { Assert.fail("labClientOptions is null!"); } }