List of usage examples for org.openqa.selenium WebElement getCssValue
String getCssValue(String propertyName);
From source file:MobileChosenIT.java
License:Apache License
private int getDropdownBottom() { WebElement dropdown = getDropdown(); String bottomString = dropdown.getCssValue("bottom"); if ("auto".equals(bottomString)) { return 0; }/* w w w.j ava 2s . c o m*/ return Integer.parseInt(bottomString.replaceAll("px", "")); }
From source file:ChosenIT.java
License:Apache License
protected int getDropdownTop() { WebElement dropdown = getDropdown(); String topString = dropdown.getCssValue("top"); if ("auto".equals(topString)) { return 0; }/*from w ww. j a v a 2 s . c o m*/ return (int) Double.parseDouble(topString.replaceAll("px", "")); }
From source file:be.rubus.web.testing.CommonElementCode.java
License:Apache License
protected String getComputedCssValue(WebElement someElement, String cssName) { return someElement.getCssValue(cssName); }
From source file:br.ufmg.dcc.saotome.beholder.selenium.WebElementAdapter.java
License:Apache License
@Override public String getCssValue(final String propertyName) { return new StaleExceptionResolver<String>() { @Override/* w w w . j av a 2 s . c o m*/ public String execute(WebElement element) { return element.getCssValue(propertyName); } }.waitForElement(); }
From source file:ch.vorburger.vaadin.designer.tests.web.DesignerWebDriverTest.java
License:Apache License
@Test public void testChangeModelAssertFieldMovedInBrowser() throws Exception { screen.getFields().get(0).setX(44);//from ww w . j a va 2 s . c o m screen.getFields().get(0).setY(56); WebElement fieldToDrag = driver.findElement(By.id("name")); WebElement parentDIV = fieldToDrag.findElement(By.xpath("..")); assertEquals("44px", parentDIV.getCssValue("left")); assertEquals("56px", parentDIV.getCssValue("top")); }
From source file:com.bc.opec.webtests.TestUserInfo.java
License:Open Source License
@Test public void testThatUserInfoBalloonIsShown() throws Exception { WebElement webElement = driver.findElement(By.xpath("//*/div[@aria-describedby='user-info-balloon']")); assertNotNull(webElement);/*from www .j av a2 s. c o m*/ if (webElement.getAttribute("aria-describedby").equals("user-info-balloon")) { assertEquals("none", webElement.getCssValue("display").toLowerCase()); final WebElement element = driver.findElement(By.id("userInfoToggleBtn")); Actions actions = new Actions(driver); actions.moveToElement(element).click().perform(); assertEquals("block", webElement.getCssValue("display").toLowerCase()); } }
From source file:com.cengage.mindtap.keywords.GradeBookAppPageAction.java
public void verifyColorEncoding() { try {/*from w w w.j a va2 s . c o m*/ waitForElementPresent("manualgradeactivity"); String activitycolor; for (WebElement manualgradeactivitylinks : elements("manualgradeactivity")) { scrollDown(manualgradeactivitylinks); activitycolor = manualgradeactivitylinks.getCssValue("color"); //System.out.println("Color of activity: "+activitycolor); if (activitycolor.equalsIgnoreCase("rgba(248, 128, 23, 1)")) { Assert.assertTrue(true, "Manual graded activity link is not shown orange"); //System.out.println("Activity text :"+manualgradeactivitylinks.getText()); } else { Assert.assertTrue(false, "Manual graded activity link is shown orange"); } } } catch (NoSuchElementException ex) { Reporter.log("No manual graded activity found for the current user"); } }
From source file:com.comcast.dawg.house.LoginPageIT.java
License:Apache License
/** * @author Kevin Pearson//from w w w. j a v a2 s . com * @throws IOException */ @Test(description = "Tests if a message explaining that a username was invalid " + "becomes visible when the user tries to log in with an invalid username", groups = "uitest") public void testBadLogin() throws IOException { RemoteWebDriver driver = drivers.get(); String user = "$$$$"; driver.get(TestServers.getHouse()); WebElement badLoginMessage = driver.findElementById(LoginPage.BAD_USER_MSG_ID); Assert.assertEquals(badLoginMessage.getCssValue("display"), "none"); loginWithUserName(driver, user); String expectedNewPageUrl = TestServers.getHouse(); Assert.assertEquals(driver.getCurrentUrl(), expectedNewPageUrl); badLoginMessage = driver.findElementById(LoginPage.BAD_USER_MSG_ID); Assert.assertEquals(badLoginMessage.getCssValue("display"), "block"); }
From source file:com.consol.citrus.selenium.actions.FindElementAction.java
License:Apache License
/** * Validates found web element with expected content. * @param element/*from w ww. j a v a 2s . c o m*/ * @param browser * @param context */ protected void validate(WebElement element, SeleniumBrowser browser, TestContext context) { validateElementProperty("tag-name", tagName, element.getTagName(), context); validateElementProperty("text", text, element.getText(), context); Assert.isTrue(displayed == element.isDisplayed(), String.format( "Selenium web element validation failed, " + "property 'displayed' expected '%s', but was '%s'", displayed, element.isDisplayed())); Assert.isTrue(enabled == element.isEnabled(), String.format( "Selenium web element validation failed, " + "property 'enabled' expected '%s', but was '%s'", enabled, element.isEnabled())); for (Map.Entry<String, String> attributeEntry : attributes.entrySet()) { validateElementProperty(String.format("attribute '%s'", attributeEntry.getKey()), attributeEntry.getValue(), element.getAttribute(attributeEntry.getKey()), context); } for (Map.Entry<String, String> styleEntry : styles.entrySet()) { validateElementProperty(String.format("css style '%s'", styleEntry.getKey()), styleEntry.getValue(), element.getCssValue(styleEntry.getKey()), context); } }
From source file:com.example.selenium.action.DoubleClick.java
@Test public void testDoubleClick() throws Exception { WebElement element = driver.findElement(By.id("div")); // Verify color is Blue Assert.assertEquals("rgba(0, 0, 255, 1)", element.getCssValue("background-color")); Thread.sleep(2000);//w w w .j a va 2 s . com Actions builder = new Actions(driver); builder.doubleClick(element).perform(); Thread.sleep(2000); //Verify Color is Yellow Assert.assertEquals("rgba(255, 255, 0, 1)", element.getCssValue("background-color")); }