def _get_element_dimensions(element):
        """Returns an element's position and size

        :param WebElement element: Element to get dimensions for
        :return:
        """

        if isinstance(element, WebElement):

            # Get dimensions of element
            location = element.location
            size = element.size

            return {
                'top': int(location['y']),
                'left': int(location['x']),
                'width': int(size['width']),
                'height': int(size['height'])
            }

        raise ValueError("element must be a WebElement")