Removing is operator in preference to as operator for .NET code
@@ -1419,20 +1419,6 @@ public void Submit()
}
}
- public override bool Equals(object obj)
- {
- if (!(obj is IWebElement))
- return false;
-
- IWebElement other = (IWebElement)obj;
- if(other is IWrapsElement wrapper)
- {
- other = ((IWrapsElement)wrapper).WrappedElement;
- }
-
- return underlyingElement.Equals(other);
- }
-
/// <summary>
/// Click this element. If this causes a new page to load, this method will block until
/// the page has loaded. At this point, you should discard all references to this element
@@ -1574,6 +1560,28 @@ public ReadOnlyCollection<IWebElement> FindElements(By by)
return wrappedElementList.AsReadOnly();
}
+
+ /// <summary>
+ /// Determines whether the specified <see cref="EventFiringWebElement"/> is equal to the current <see cref="EventFiringWebElement"/>.
+ /// </summary>
+ /// <param name="obj">The <see cref="EventFiringWebElement"/> to compare to the current <see cref="EventFiringWebElement"/>.</param>
+ /// <returns><see langword="true"/> if the specified <see cref="EventFiringWebElement"/> is equal to the current <see cref="EventFiringWebElement"/>; otherwise, <see langword="false"/>.</returns>
+ public override bool Equals(object obj)
+ {
+ IWebElement other = obj as IWebElement;
+ if (other == null)
+ {
+ return false;
+ }
+
+ IWrapsElement otherWrapper = other as IWrapsElement;
+ if (otherWrapper != null)
+ {
+ other = otherWrapper.WrappedElement;
+ }
+
+ return underlyingElement.Equals(other);
+ }
}
}
}
