Synchronization to deal with elements that are present, and are visible

        :raises: ElementVisiblityTimeout
18804
def wait_for_available(self, locator):
        
        for i in range(timeout_seconds):
            try:
                if self.is_element_available(locator):
                    break
            except:
                pass
            time.sleep(1)
        else:
            raise ElementVisiblityTimeout("%s availability timed out" % locator)
        return True
864717
def syncView(self):
        
        if not self.updatesEnabled():
            return
        
        for item in self.topLevelItems():
            try:
                item.syncView(recursive=True)
            except AttributeError:
                continue
755524
async function preRenderElements (elements, globals) {
  for (let element of elements) {
    await element.preRender(globals)
  }
}
277014
async function postRenderElements (elements, globals) {
  for (let element of elements) {
    await element.postRender(globals)
  }
}
843321
protected void setElementVisible(Widget widget, boolean visible) {

        if (visible) {
            widget.getElement().getStyle().clearDisplay();
        } else {
            widget.getElement().getStyle().setDisplay(Display.NONE);
        }

    }
441015
def find_visible_elements(self, selector, by=By.CSS_SELECTOR, limit=0):
        
        self.wait_for_ready_state_complete()
        if page_utils.is_xpath_selector(selector):
            by = By.XPATH
        if page_utils.is_link_text_selector(selector):
            selector = page_utils.get_link_text_from_selector(selector)
            by = By.LINK_TEXT
        v_elems = page_actions.find_visible_elements(self.driver, selector, by)
        if limit and limit > 0 and len(v_elems) > limit:
            v_elems = v_elems[:limit]
        return v_elems
514448
function checkShow(){
  /**
   * Checks visibility of an element on a page in a browser
   * @param {HTMLElement} element some DOM node
   * @private
   * @return {boolean}
   */
  function isVisible(element){
    if (getComputedStyle(element, 'visibility') != 'visible')
      return false;

    var box = getBoundingRect(element);

    if (!box.width || !box.height)
      return false;

    return true;
  }

  var list = getSelectorList(SHOW_EVENT);

  for (var i = 0; i < list.length; i++)
  {
    var selector = list[i];
    var elements = document.querySelectorAll(getCssSelectorFromPath(selector.selector, true));
    var visibleElement = basis.array.search(basis.array(elements), true, isVisible);
    var visible = Boolean(visibleElement);
    var state;

    if (!hasOwnProperty.call(list.visible, selector.selectorStr))
      state = list.visible[selector.selectorStr] = false;
    else
      state = list.visible[selector.selectorStr];

    list.visible[selector.selectorStr] = visible;

    if (state == false && visible)
      track({
        type: 'ui',
        path: stringifyPath(getPathByNode(visibleElement)),
        selector: selector.selectorStr,
        event: SHOW_EVENT,
        data: selector.data
      });
  }
}
735842
function(element, callback, nowait) {
    var self = this;
    if (!nowait) {
      this.waitForPage(function() {
        self.waitForElement(element, callback, true);
      });
    }
    else {
      var loadWait = function() {
        setTimeout(function() {
          self.waitForElement(element, callback, true);
        }, 100);
      };
      if (nowait) {
        getPage(function(page) {
          page.evaluate(function(element) {
            var element = jQuery(element);
            return ((element.length > 0) && element.is(':visible'));
          }, function(found) {
            if (found) {
              self.debug('Element ' + element + ' found');
              callback.call(self);
            }
            else {
              loadWait();
            }
          }, element);
        });
      }
      else {
        loadWait();
      }
    }
  }
157556
def set_visibility_for(methods, vis, singleton = false)
      methods_matching methods, singleton do |m|
        m.visibility = vis
      end
    end
337020
public void viewShouldNotShowElement(String viewName, String elementName) throws IllegalAccessException,
			InterruptedException {
		boolean pass = false;

		long startOfLookup = System.currentTimeMillis();

		int timeoutInMillies = getSeleniumManager().getTimeout() * 1000;

		while (!pass) {

			WebElement found = getElementFromReferencedView(viewName, elementName);
			try {
				pass = !found.isDisplayed();
			} catch (NoSuchElementException e) {
				pass = true;
			}

			if (!pass) {
				Thread.sleep(100);
			}
			if (System.currentTimeMillis() - startOfLookup > timeoutInMillies) {
				String foundLocator = getElementLocatorFromReferencedView(viewName, elementName);
				fail("The element \"" + foundLocator + "\" referenced by \"" + elementName + "\" on view/page \"" + viewName + "\" is still found where it is not expected after " + getSeleniumManager().getTimeout() + " seconds.");
				break;
			}
		}
	}
980457
function onVisibilityChangeFactory(hidden) {
  return function onVisibilityChange(evt) {
    if (document[hidden]) {
      debug('disable while hidden');
      stop();
    } else {
      debug('enable while visible');
      if (process.env.NODE_ENV === 'development') {
        const current = now();

        for (let i = 0, n = timeoutQueue.length; i < n; i++) {
          const item = timeoutQueue[i];

          if (item.time <= current) {
            debug('timeout should trigger for "%s"', item.id);
          } else {
            const date = new Date();

            date.setMilliseconds(date.getMilliseconds() + item.time - current);
            debug('timeout for "%s" expected at %s', item.id, date.toLocaleTimeString());
          }
        }
      }
      run();
    }
  };
}
563188
def syncView(self, recursive=False):
        
        # update the view widget
        gantt = self.ganttWidget()
        tree = self.treeWidget()
        
        if not gantt:
            return
        
        vwidget = gantt.viewWidget()
        scene = vwidget.scene()
        cell_w = gantt.cellWidth()
        
        tree_offset_y  = tree.header().height() + 1
        tree_offset_y += tree.verticalScrollBar().value()
        
        # collect the items to work on
        items = [self]
        if recursive:
            items += list(self.children(recursive=True))
        
        for item in items:
            # grab the view item from the gantt item
            vitem = item.viewItem()
            if not vitem.scene():
                scene.addItem(vitem)
            
            # make sure the item should be visible
            if item.isHidden() or not tree:
                vitem.hide()
                continue
            
            vitem.show()
            tree_rect = tree.visualItemRect(item)
            
            tree_y  = tree_rect.y() + tree_offset_y
            tree_h  = tree_rect.height()
            
            # check to see if this item is hidden
            if tree_rect.height() == 0:
                vitem.hide()
                continue
            
            if gantt.timescale() in (gantt.Timescale.Minute,
                                     gantt.Timescale.Hour, 
                                     gantt.Timescale.Day):
                dstart = item.dateTimeStart()
                dend   = item.dateTimeEnd()
                view_x = scene.datetimeXPos(dstart)
                view_r = scene.datetimeXPos(dend)
                view_w = view_r - view_x
            else:
                view_x = scene.dateXPos(item.dateStart())
                view_w = item.duration() * cell_w
            
                # determine the % off from the length based on this items time
                if not item.isAllDay():
                    full_day = 24 * 60 * 60 # full days worth of seconds
                    
                    # determine the start offset
                    start      = item.timeStart()
                    start_day  = (start.hour() * 60 * 60) 
                    start_day += (start.minute() * 60) 
                    start_day += (start.second())
                    
                    offset_start = (start_day / float(full_day)) * cell_w
                    
                    # determine the end offset
                    end         = item.timeEnd()
                    end_day     = (end.hour() * 60 * 60)
                    end_day    += (start.minute() * 60)
                    end_day    += (start.second() + 1) # forces at least 1 sec
                    
                    offset_end  = ((full_day - end_day) / float(full_day))
                    offset_end *= cell_w
                    
                    # update the xpos and widths
                    view_x += offset_start
                    view_w -= (offset_start + offset_end)
            
            view_w = max(view_w, 5)
            
            vitem.setSyncing(True)
            vitem.setPos(view_x, tree_y)
            vitem.setRect(0, 0, view_w, tree_h)
            vitem.setSyncing(False)
            
            # setup standard properties
            flags  = vitem.ItemIsSelectable 
            flags |= vitem.ItemIsFocusable
            
            if item.flags() & Qt.ItemIsEditable:
                flags |= vitem.ItemIsMovable
            
            vitem.setFlags(flags)
            item.syncDependencies()
1171260
public void setMinuteTickMarksVisible(final boolean VISIBLE) {
        if (null == minuteTickMarksVisible) {
            _minuteTickMarksVisible = VISIBLE;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            minuteTickMarksVisible.set(VISIBLE);
        }
    }
222394
def should_see_in_seconds(self, text, timeout):
    

    def check_element():
        """Check for an element with the given content."""

        assert contains_content(world.browser, text), \
            "Expected element with the given text."

    wait_for(check_element)(timeout=int(timeout))
37791
function () {
        checkDisposed(this);
        if (this.isStopped) { return; }
        this.isStopped = true;
        for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
          os[i].onCompleted();
        }

        this.observers.length = 0;
      }
1232106
def wait_gone(self, timeout=None, raise_error=True):
        
        start_time = time.time()
        if timeout is None or timeout <= 0:
            timeout = self.timeout
        while start_time + timeout > time.time():
            if not self.exists:
                return True
        if not raise_error:
            return False
        raise WDAElementNotDisappearError("element not gone")
1273390
public static void waitUntilElementIsInvisible(final String elementLocator) {
        logger.entering(elementLocator);
        By by = HtmlElementUtils.resolveByType(elementLocator);
        ExpectedCondition<Boolean> condition = ExpectedConditions.invisibilityOfElementLocated(by);
        waitForCondition(condition);
        logger.exiting();
    }