List of usage examples for org.openqa.selenium By className
public static By className(String className)
From source file:WebTestSelenium6.java
public void testTagNameByClass() { assertEquals(driver.findElement(By.className("marquee")).getTagName(), "div"); }
From source file:WebTestSelenium2.java
public void testTagNameByClass() { assertEquals(driver.findElement(By.className("responsive-container")).getTagName(), "div"); }
From source file:WebTestSelenium2.java
public void testElementsByClassName() { assertEquals(driver.findElements(By.className("frontpage-teaser")).size(), 14); }
From source file:SmokeTester_UnitTest.java
private boolean isElementExist(String elementyype, String elementtosearch, WebDriver driver) { System.out.println("input for isElementExist: " + elementyype + "-" + elementtosearch); if (elementyype.compareToIgnoreCase("class") == 0) { try {/*from w ww .java2s. c om*/ driver.findElement(By.className(elementtosearch)); return true; } catch (org.openqa.selenium.NoSuchElementException nse) { return false; } } if (elementyype.compareToIgnoreCase("xpath") == 0) { try { driver.findElement(By.xpath(elementtosearch)); return true; } catch (org.openqa.selenium.NoSuchElementException nse) { return false; } } if (elementyype.compareToIgnoreCase("id") == 0) { try { driver.findElement(By.id(elementtosearch)); return true; } catch (org.openqa.selenium.NoSuchElementException nse) { return false; } } return true; }
From source file:WebTestSelenium4.java
public void testTagNameByClass() { assertEquals(driver.findElement(By.className("nav-drawer")).getTagName(), "div"); }
From source file:ChosenIT.java
License:Apache License
/** * This test asserts that a {@link com.arcbees.chosen.client.gwt.ChosenValueListBox} can be enabled/disabled * successfully.//from www.j a v a2 s .co m */ @Test public void enabledDisabled() { // Given loadTestCase(new EnabledDisabled()); String disabledClassName = "com-arcbees-chosen-client-resources-ChosenCss-chzn-disabled"; // When WebElement disableButton = webDriverWait() .until(presenceOfElementLocated(ByDebugId.id(EnabledDisabled.DISABLE_DEBUG_ID))); disableButton.click(); // Then webDriverWait().until(presenceOfElementLocated(By.className(disabledClassName))); // When WebElement enableButton = webDriverWait() .until(presenceOfElementLocated(ByDebugId.id(EnabledDisabled.ENABLE_DEBUG_ID))); enableButton.click(); // Then try { int quickTimeout = 1; // we don't want this test to wait for too long new WebDriverWait(webDriver, quickTimeout) .until(presenceOfElementLocated(By.className(disabledClassName))); fail("The ChosenValueListBox shouldn't be enabled at this point"); } catch (TimeoutException e) { // success, element should be absent from DOM } }
From source file:ChosenIT.java
License:Apache License
protected WebElement getDropdown() { return webDriverWait().until( presenceOfElementLocated(By.className("com-arcbees-chosen-client-resources-ChosenCss-chzn-drop"))); }
From source file:ChosenIT.java
License:Apache License
protected boolean isMobileChosenComponent() { List<WebElement> multiContainer = webDriver .findElements(By.className("com-arcbees-chosen-client-resources-ChosenCss-chzn-mobile-container")); return multiContainer.size() != 0; }
From source file:ChosenIT.java
License:Apache License
protected boolean isMultipleChosenComponent() { List<WebElement> multiContainer = webDriver .findElements(By.className("com-arcbees-chosen-client-resources-ChosenCss-chzn-container-multi")); return multiContainer.size() != 0; }
From source file:WebTestSelenium3.java
public void testTagNameByClass() { assertEquals(driver.findElement(By.className("dropdown-toggle")).getTagName(), "a"); }