Soft assert for whether and element is present and visible in the current window/frame

        :params locator: the locator of the element to search for
        :params msg: (Optional) msg explaining the difference
328737
def verify_visible(self, locator, msg=None):
        
        try:
            self.assert_visible(locator, msg)
        except AssertionError, e:
            if msg:
                m = "%s:\n%s" % (msg, str(e))
            else:
                m = str(e)
            self.verification_erorrs.append(m)
759198
def _element(cls):
        '''    '''
        if not cls.__is_selector():
            raise Exception("Invalid selector[%s]." %cls.__control["by"])
        
        driver = Web.driver
        try:            
            elements = WebDriverWait(driver, cls.__control["timeout"]).until(lambda driver: getattr(driver,"find_elements")(cls.__control["by"], cls.__control["value"]))
        except:                        
            raise Exception("Timeout at %d seconds.Element(%s) not found." %(cls.__control["timeout"],cls.__control["by"]))
        
        if len(elements) < cls.__control["index"] + 1:                    
            raise Exception("Element [%s]: Element Index Issue! There are [%s] Elements! Index=[%s]" % (cls.__name__, len(elements), cls.__control["index"]))
        
        if len(elements) > 1:              
            print("Element [%s]: There are [%d] elements, choosed index=%d" %(cls.__name__,len(elements),cls.__control["index"]))
        
        elm = elements[cls.__control["index"]]
        cls.__control["index"] = 0        
        return elm
235942
function(elementA, elementB) {

        var isSuccessor = false;
        this.search(elementA, function(element) {
            if (element === elementB && element !== elementA) {
                isSuccessor = true;
                return false;
            }
        }, { outbound: true });
        return isSuccessor;
    }
1357955
function eventHandler(trackedElements = {}, options = { tolerance: 0 }) {
    const selectors = Object.keys(trackedElements);
    let testVisibility;

    if (!selectors.length) return;

    if (options.container === window) {
        testVisibility = inViewport;
    } else {
        testVisibility = inContainer;
    }

    selectors.forEach((selector) => {
        trackedElements[selector].nodes.forEach((item) => {
            if (testVisibility(item.node, options)) {
                item.wasVisible = item.isVisible;
                item.isVisible = true;
            } else {
                item.wasVisible = item.isVisible;
                item.isVisible = false;
            }
            if (item.isVisible === true && item.wasVisible === false) {
                if (!trackedElements[selector].enter) return;

                Object.keys(trackedElements[selector].enter).forEach((callback) => {
                    if (typeof trackedElements[selector].enter[callback] === 'function') {
                        trackedElements[selector].enter[callback](item.node, 'enter');
                    }
                });
            }
            if (item.isVisible === false && item.wasVisible === true) {
                if (!trackedElements[selector].leave) return;

                Object.keys(trackedElements[selector].leave).forEach((callback) => {
                    if (typeof trackedElements[selector].leave[callback] === 'function') {
                        trackedElements[selector].leave[callback](item.node, 'leave');
                    }
                });
            }
        });
    });
}
638616
def verify_element_present(self, locator, msg=None):
        
        try:
            self.asset_element_present(locator, msg)
        except AssertionError, e:
            if msg:
                m = "%s:\n%s" % (msg, str(e))
            else:
                m = str(e)
            self.verification_erorrs.append(m)
263466
def is_tracking_shield_displayed(self):
        
        with self.selenium.context(self.selenium.CONTEXT_CHROME):
            if self.window.firefox_version >= 63:  # Bug 1471713, 1476218
                el = self.root.find_element(*self._tracking_protection_shield_locator)
                return el.get_attribute("active") is not None
            el = self.root.find_element(By.ID, "tracking-protection-icon")
            return bool(el.get_attribute("state"))
95965
public static ExpectedCondition<List<WebElement>> presenceOfAllElementsLocatedBy(
    final By locator) {
    return new ExpectedCondition<List<WebElement>>() {
      @Override
      public List<WebElement> apply(WebDriver driver) {
        List<WebElement> elements = driver.findElements(locator);
        return elements.size() > 0 ? elements : null;
      }

      @Override
      public String toString() {
        return "presence of any elements located by " + locator;
      }
    };
  }
850655
def element_should_be_disabled(self, locator, loglevel='INFO'):
        
        if self._element_find(locator, True, True).is_enabled():
            self.log_source(loglevel)
            raise AssertionError("Element '%s' should be disabled "
                                 "but did not" % locator)
        self._info("Element '%s' is disabled ." % locator)
212880
def assert_element_visible(self, selector, by=By.CSS_SELECTOR,
                               timeout=settings.SMALL_TIMEOUT):
        
        if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
            timeout = self.__get_new_timeout(timeout)
        self.assert_element(selector, by=by, timeout=timeout)
        return True
626507
public void mouseHoverOverElement(By locator) {
        SynchronisationService synchronisationService = new SynchronisationService();

        synchronisationService.waitAndAssertForExpectedCondition(ExpectedConditions.visibilityOfElementLocated(locator));

        WebElement element = getWebDriver().findElement(locator);
        Actions builder = new Actions(getWebDriver());
        Actions hoverOverRegistrar = builder.moveToElement(element);
        hoverOverRegistrar.perform();
    }
1100906
public function isElementVisible(string $locator, int $timeout = 5): bool
    {
        try {
            $element = $this->findElement($locator, $timeout);

            return isset($element) && $element->isVisible();
        } catch (ElementNotFoundException $e) {
            return false;
        }
    }
261654
def element_value_should_not_contain(self, locator, value):
		""""""

		self._info("Verifying element '%s' value does not contain '%s'" % (locator, value))
		
		element = self._element_find(locator, True, True)
		elem_value = str(element.get_attribute('value'))
		
		if value in elem_value:
			raise AssertionError("Value '%s' was found in element '%s' while it shouldn't have" % (value, locator))
657129
def text_should_be_visible(self, text, exact_match=False, loglevel='INFO'):
        
        if not self._element_find_by_text(text, exact_match).is_displayed():
            self.log_source(loglevel)
            raise AssertionError("Text '%s' should be visible "
                                 "but did not" % text)
1114118
def assert_visible(tag, element_id)
			if RWebSpec.framework =~ /selenium/i
      	perform_assertion { assert(eval("#{tag}(:id, '#{element_id.to_s}').displayed?"), "Element '#{tag}' with id: '#{element_id}' not visible") }
			else
			  perform_assertion { assert(eval("#{tag}(:id, '#{element_id.to_s}').visible?"), "Element '#{tag}' with id: '#{element_id}' not visible") }
			end
    end
906407
public static void w(String msg, Element element) {
		messager.printMessage(Diagnostic.Kind.WARNING, msg, element);
	}
584082
public void selectFrame() {
        String cantSelect = "Unable to focus on frame ";
        String action = "Focusing on frame " + prettyOutput();
        String expected = "Frame " + prettyOutput() + " is present, displayed, and focused";
        try {
            // wait for element to be present
            if (isNotPresent(action, expected, cantSelect)) {
                return;
            }
            // wait for element to be displayed
            if (isNotDisplayed(action, expected, cantSelect)) {
                return;
            }
            // select the actual frame
            WebElement webElement = getWebElement();
            driver.switchTo().frame(webElement);
        } catch (Exception e) {
            log.warn(e);
            reporter.fail(action, expected, cantSelect + prettyOutputEnd() + e.getMessage());
            return;
        }
        reporter.pass(action, expected, "Focused on frame " + prettyOutputEnd().trim());
    }
1148642
public boolean getElementExists(By locator) {
		waitForLoaders();
		List<WebElement> foundElements = getWebDriver().findElements(locator);
		return (foundElements.size() > 0);
	}