Get center coordinates of an element

        :param element: either a WebElement, PageElement or element locator as a tuple (locator_type, locator_value)
        :returns: dict with center coordinates
552633
def get_center(self, element):
        
        web_element = self.get_web_element(element)
        location = web_element.location
        size = web_element.size
        return {'x': location['x'] + (size['width'] / 2), 'y': location['y'] + (size['height'] / 2)}
610011
def getCenter(self):
        
        return Location(self.x+(self.w/2), self.y+(self.h/2))
642398
def _makeLocationElement(self, locationObject, name=None):
        

        locElement = ET.Element("location")
        if name is not None:
           locElement.attrib['name'] = name
        for dimensionName, dimensionValue in locationObject.items():
           dimElement = ET.Element('dimension')
           dimElement.attrib['name'] = dimensionName
           if type(dimensionValue)==tuple:
               dimElement.attrib['xvalue'] = "%f"%dimensionValue[0]
               dimElement.attrib['yvalue'] = "%f"%dimensionValue[1]
           else:
               dimElement.attrib['xvalue'] = "%f"%dimensionValue
           locElement.append(dimElement)
        return locElement
706764
def get_node(self, element):
        
        """
        ns, tag = self.split_namespace(element.tag)
        return {'tag': tag, 'value': (element.text or '').strip(), 'attr': element.attrib, 'namespace': ns}
1126194
def center(self):
        '''
        
        '''
        try:
            return self._center
        except AttributeError:
            pass
        self._center = Point()
        return self._center
558729
function(element) {
    var r = { x: element.offsetLeft, y: element.offsetTop };
    if (element.offsetParent) {
      var tmp = getAbsolutePosition(element.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
  }
385977
def get_text(self, locator):
        
        text = self._get_text(locator)
        self._info("Element '%s' text is '%s' " % (locator, text))
        return text
212354
def _get_factors(self, element):
        
        xdim, ydim = element.dimensions()[:2]
        xvals, yvals = [element.dimension_values(i, False)
                        for i in range(2)]
        coords = tuple([v if vals.dtype.kind in 'SU' else dim.pprint_value(v) for v in vals]
                  for dim, vals in [(xdim, xvals), (ydim, yvals)])
        if self.invert_axes: coords = coords[::-1]
        return coords
110612
def center
      point = location
      dimensions = size
      Selenium::WebDriver::Point.new(point.x + (dimensions['width'] / 2),
                                     point.y + (dimensions['height'] / 2))
    end
661922
def get_extents(self, element, ranges, range_type='combined'):
        
        if range_type == 'extents':
            return element.nodes.extents
        xdim, ydim = element.nodes.kdims[:2]
        xpad = .05 if self.label_index is None else 0.25
        x0, x1 = ranges[xdim.name][range_type]
        y0, y1 = ranges[ydim.name][range_type]
        xdiff = (x1-x0)
        ydiff = (y1-y0)
        if self.label_position == 'right':
            x0, x1 = x0-(0.05*xdiff), x1+xpad*xdiff
        else:
            x0, x1 = x0-xpad*xdiff, x1+(0.05*xdiff)
        x0, x1 = max_range([xdim.range, (x0, x1)])
        y0, y1 = max_range([ydim.range, (y0-(0.05*ydiff), y1+(0.05*ydiff))])
        return (x0, y0, x1, y1)
352161
def _element_str(self):
        
        # pylint: disable=no-else-return
        if isinstance(self.element, CIMProperty):
            return _format("property {0!A} in class {1!A} (in {2!A})",
                           self.propname, self.classname, self.namespace)
        elif isinstance(self.element, CIMMethod):
            return _format("method {0!A} in class {1!A} (in {2!A})",
                           self.methodname, self.classname, self.namespace)
        assert isinstance(self.element, CIMParameter)
        return _format("parameter {0!A} of method {1!A} in class {2!A} "
                       "(in {3!A})",
                       self.parametername, self.methodname, self.classname,
                       self.namespace)
1349346
def location(self):
        """"""
        if self._w3c:
            old_loc = self._execute(Command.GET_ELEMENT_RECT)['value']
        else:
            old_loc = self._execute(Command.GET_ELEMENT_LOCATION)['value']
        new_loc = {"x": round(old_loc['x']),
                   "y": round(old_loc['y'])}
        return new_loc
516500
function findCenter( elem ) {
	var offset,
		document = $( elem.ownerDocument );
	elem = $( elem );
	offset = elem.offset();

	return {
		x: offset.left + elem.outerWidth() / 2 - document.scrollLeft(),
		y: offset.top + elem.outerHeight() / 2 - document.scrollTop()
	};
}
107475
function getElementRect(elem) {
  const docElem = elem.ownerDocument.documentElement;

  // FF 2, Safari 3 and Opera 9.5- do not support getBoundingClientRect().
  // IE9- will throw if the element is not in the document.
  if (!('getBoundingClientRect' in elem) || !containsNode(docElem, elem)) {
    return {
      left:   0,
      right:  0,
      top:    0,
      bottom: 0
    };
  }

  // Subtracts clientTop/Left because IE8- added a 2px border to the
  // <html> element (see http://fburl.com/1493213). IE 7 in
  // Quicksmode does not report clientLeft/clientTop so there
  // will be an unaccounted offset of 2px when in quirksmode
  const rect = elem.getBoundingClientRect();

  return {
    left:   Math.round(rect.left) - docElem.clientLeft,
    right:  Math.round(rect.right) - docElem.clientLeft,
    top:    Math.round(rect.top) - docElem.clientTop,
    bottom: Math.round(rect.bottom) - docElem.clientTop
  };
}
753696
def center(self, reference=None):
        
        return self.from_center(x=0.0, y=0.0, z=0.0, reference=reference)
1174986
def _element_to_dict(data, position, obj_end, opts):
    """"""
    element_type = data[position:position + 1]
    position += 1
    element_name, position = _get_c_string(data, position, opts)
    try:
        value, position = _ELEMENT_GETTER[element_type](data, position,
                                                        obj_end, opts,
                                                        element_name)
    except KeyError:
        _raise_unknown_type(element_type, element_name)

    if opts.type_registry._decoder_map:
        custom_decoder = opts.type_registry._decoder_map.get(type(value))
        if custom_decoder is not None:
            value = custom_decoder(value)

    return element_name, value, position
175069
function( element ) {
		element = element || this.element;

		var offset = element.offset(),
			width = element.width(),
			height = element.height();

		return {
			x1: offset.left,
			y1: offset.top,
			x2: offset.left + width,
			y2: offset.top + height,
			surface: width * height,
			contentItem: this
		};
	}