congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
WebElement.getSize
Code IndexAdd Tabnine to your IDE (free)

How to use
getSize
method
in
org.openqa.selenium.WebElement

Best Java code snippets using org.openqa.selenium.WebElement.getSize (Showing top 20 results out of 657)

origin: selenide/selenide

private BufferedImage takeScreenshotAsImage(WebDriver webdriver, WebElement element) {
 if (!(webdriver instanceof TakesScreenshot)) {
  log.warning("Cannot take screenshot because browser does not support screenshots");
  return null;
 }
 byte[] screen = ((TakesScreenshot) webdriver).getScreenshotAs(OutputType.BYTES);
 Point elementLocation = element.getLocation();
 try {
  BufferedImage img = ImageIO.read(new ByteArrayInputStream(screen));
  int elementWidth = element.getSize().getWidth();
  int elementHeight = element.getSize().getHeight();
  if (elementWidth > img.getWidth()) {
   elementWidth = img.getWidth() - elementLocation.getX();
  }
  if (elementHeight > img.getHeight()) {
   elementHeight = img.getHeight() - elementLocation.getY();
  }
  return img.getSubimage(elementLocation.getX(), elementLocation.getY(), elementWidth, elementHeight);
 }
 catch (IOException e) {
  log.log(SEVERE, "Failed to take screenshot of " + element, e);
  return null;
 }
 catch (RasterFormatException e) {
  log.warning("Cannot take screenshot because element is not displayed on current screen position");
  return null;
 }
}
origin: selenide/selenide

 return null;
int iframeHeight = iframe.getSize().getHeight();
SelenideTargetLocator switchTo = new SelenideTargetLocator(driver.config(), driver.getWebDriver());
switchTo.frame(iframe);
int elementWidth = element.getSize().getWidth();
int elementHeight = element.getSize().getHeight();
if (elementWidth > iframeWidth) {
 elementWidth = iframeWidth - elementLocation.getX();
origin: galenframework/galen

  @Override
  public Rect findArea(WebPageElement webPageElement) {
    WebElement webElement = webPageElement.getWebElement();
    Point location = webElement.getLocation();
    Dimension size = webElement.getSize();
    return new Rect(location.getX(), location.getY(), size.getWidth(), size.getHeight());
  }
}),
origin: TEAMMATES/teammates

/**
 * Checks if the midpoint of an element is covered by any other element.
 * @return true if element is covered, false otherwise.
 */
public boolean isElementCovered(WebElement element) {
  int x = element.getLocation().x + element.getSize().width / 2;
  int y = element.getLocation().y + element.getSize().height / 2;
  WebElement topElem = (WebElement) executeScript("return document.elementFromPoint(" + x + "," + y + ");");
  return !topElem.equals(element);
}
origin: org.rapidpm/rapidpm-vaadin-testbench-ng-m-pageobject

@Override
public Dimension getSize() {
 if (delegateWebElement != null) {
  return delegateWebElement.getSize();
 } else {
  return wrappedWebElement.getSize();
 }
}
origin: yandex-qatools/htmlelements

/**
 * Gets width and height of the rendered element. See {@link org.openqa.selenium.WebElement#getSize()}
 * for more details.
 *
 * @return The size of the element on the page.
 */
@Override
public Dimension getSize() {
  return wrappedElement.getSize();
}
origin: com.vaadin/vaadin-testbench-core

@Override
public Dimension getSize() {
  waitForVaadin();
  return wrappedElement.getSize();
}
origin: qaprosoft/carina

/**
 * Method to generate rectangle for the element since current version of
 * appium driver throws unimplemented exception
 * 
 * @param element WebElement
 * @return Rectangle
 */
public Rectangle getRect(WebElement element) {
  return new Rectangle(element.getLocation(), element.getSize());
}
origin: vmi/selenese-runner-java

  @Override
  public Integer execute(Context context, String... args) {
    return context.findElement(args[ARG_LOCATOR]).getSize().getHeight();
  }
}
origin: qaprosoft/carina

@Override
public Dimension doGetSize() {
  Dimension dim = element.getSize();
  LOGGER.debug(Messager.ELEMENT_ATTRIBUTE_FOUND.getMessage("Size", dim.toString(), getName()));
  return dim;
}
origin: com.atlassian.selenium/atlassian-webdriver-core

@Override
public int getRight()
{
  return getLeft() + getElement().getSize().getWidth();
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

public EditIssueTypeSchemePage moveFromAvailableToAboveSelected(final String availableIssueType, final String selectedIssueType)
{
  WebElement source = getIssueTypeListItemFromAvailableOptions(availableIssueType);
  WebElement target = getIssueTypeListItemFromSelectedOptions(selectedIssueType);
  final double offset = target.getSize().getHeight() * DROP_TARGET_RATIO;
  dragAndDropWithOffset(source, target, (int) -offset);
  return this;
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

public EditIssueTypeSchemePage moveFromSelectedToAboveAvailable(final String selectedIssueType, final String availableIssueType)
{
  WebElement source = getIssueTypeListItemFromSelectedOptions(selectedIssueType);
  WebElement target = getIssueTypeListItemFromAvailableOptions(availableIssueType);
  final double offset = target.getSize().getHeight() * DROP_TARGET_RATIO;
  dragAndDropWithOffset(source, target, (int) -offset);
  return this;
}
origin: pazone/ashot

  @Override
  public Coords ofElement(WebDriver driver, WebElement element) {
    Point point = element.getLocation();
    Dimension dimension = element.getSize();
    return new Coords(
        point.getX(),
        point.getY(),
        dimension.getWidth(),
        dimension.getHeight());
  }
}
origin: com.atlassian.jira/atlassian-jira-pageobjects

private void dragAndDropWithOffset(final WebElement source, final WebElement target, final int offset)
{
  Point currentLocation = source.getLocation();
  Point destination = target.getLocation();
  // We need to ensure we have the source in view. An egrgarious hack to make sure we can do this.
  // Assumes that scrolling to the top of the page will have our source AND target in the viewable area
  driver.findElement(By.tagName("body")).getSize();
  int xOffset = destination.x - currentLocation.x + 1;
  int yOffset = destination.y - currentLocation.y + offset;
  Actions action = new Actions(driver).dragAndDropBy(source, xOffset, yOffset);
  action.perform();
}
origin: paypal/SeLion

@Override
public void swipeRight(WebElement webElement) {
  logger.entering(webElement);
  Point currentLocation = webElement.getLocation();
  Dimension elementSize = webElement.getSize();
  int x = currentLocation.getX();
  int y = currentLocation.getY();
  int endx = x + elementSize.getWidth() - 1;
  this.swipe(x,y,endx, y, OPERATION_DURATION_MILLI_SECONDS);
  logger.exiting();
}
origin: paypal/SeLion

@Override
public void swipeDown(WebElement webElement) {
  logger.entering(webElement);
  Point currentLocation = webElement.getLocation();
  Dimension elementSize = webElement.getSize();
  int x = currentLocation.getX();
  int y = currentLocation.getY();
  int endy = y + elementSize.getHeight() - 1;
  this.swipe(x, y, x, endy, OPERATION_DURATION_MILLI_SECONDS);
  logger.exiting();
}
origin: paypal/SeLion

@Override
public void swipeRight(WebElement webElement) {
  logger.entering(webElement);
  Point point = webElement.getLocation();
  Dimension dimension = webElement.getSize();
  Point start = new Point(point.getX(), point.getY());
  Point end = new Point(point.getX() + dimension.getWidth() - 1, point.getY());
  performSwipeAction(start, end);
  logger.exiting();
}
origin: paypal/SeLion

@Override
public void swipeUp(WebElement webElement) {
  logger.entering(webElement);
  Point point = webElement.getLocation();
  Dimension dimension = webElement.getSize();
  Point start = new Point(point.getX(), point.getY() + dimension.getHeight() - 1);
  Point end = new Point(point.getX(), point.getY());
  performSwipeAction(start, end);
  logger.exiting();
}
origin: Wikia/selenium-tests

public void shouldBeFullscreenAfterClickOnIcon() {
 HiViUap hiViUap = new HiViUap(driver, slotName);
 hiViUap.waitForAdLoaded();
 hiViUap.waitForVideoStart();
 hiViUap.clickFullscreenIcon();
 Dimension windowSize = driver.findElement(By.cssSelector("body")).getSize();
 Assertion.assertEquals(hiViUap.getVideoWidth(), windowSize.width);
}
org.openqa.seleniumWebElementgetSize

Javadoc

What is the width and height of the rendered element?

Popular methods of WebElement

  • getText
    Get the visible (i.e. not hidden by CSS) text of this element, including sub-elements.
  • click
    Click this element. If this causes a new page to load, you should discard all references to this ele
  • sendKeys
    Use this method to simulate typing into an element, which may set its value.
  • getAttribute
    Get the value of the given attribute of the element. Will return the current value, even if this has
  • clear
    If this element is a text entry element, this will clear the value. Has no effect on other elements.
  • isDisplayed
    Is this element displayed or not? This method avoids the problem of having to parse an element's "st
  • findElements
    Find all elements within the current context using the given mechanism. When using xpath be aware th
  • isSelected
    Determine whether or not this element is selected or not. This operation only applies to input eleme
  • findElement
    Find the first WebElement using the given method. See the note in #findElements(By) about finding vi
  • getTagName
    Get the tag name of this element. Not the value of the name attribute: will return"input" for the el
  • isEnabled
    Is the element currently enabled or not? This will generally return true for everything but disabled
  • getLocation
    Where on the page is the top left-hand corner of the rendered element?
  • isEnabled,
  • getLocation,
  • submit,
  • getCssValue,
  • getRect,
  • getScreenshotAs,
  • getValue,
  • setSelected,
  • toggle

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • JButton (javax.swing)
  • JTextField (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now