diff --git a/py/selenium/webdriver/support/expected_conditions.py b/py/selenium/webdriver/support/expected_conditions.py
index <HASH>..<HASH> 100644
--- a/py/selenium/webdriver/support/expected_conditions.py
+++ b/py/selenium/webdriver/support/expected_conditions.py
@@ -145,6 +145,8 @@ class visibility_of(object):
 
 
 def _element_if_visible(element, visibility=True):
+    if isinstance(element, str) or isinstance(element, dict):
+           raise NoSuchElementException("Invalid locator")
     return element if element.is_displayed() == visibility else False
Fix error in webelemet not created, verifing if is str or dict. (#<I>)

* fix the problem when the element is string