File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1419,6 +1419,20 @@ public void Submit()
1419
1419
}
1420
1420
}
1421
1421
1422
+ public override bool Equals ( object obj )
1423
+ {
1424
+ if ( ! ( obj is IWebElement ) )
1425
+ return false ;
1426
+
1427
+ IWebElement other = ( IWebElement ) obj ;
1428
+ if ( other is IWrapsElement wrapper )
1429
+ {
1430
+ other = ( ( IWrapsElement ) wrapper ) . WrappedElement ;
1431
+ }
1432
+
1433
+ return underlyingElement . Equals ( other ) ;
1434
+ }
1435
+
1422
1436
/// <summary>
1423
1437
/// Click this element. If this causes a new page to load, this method will block until
1424
1438
/// the page has loaded. At this point, you should discard all references to this element
Original file line number Diff line number Diff line change @@ -106,6 +106,18 @@ public void ShouldFireValueChangedEvent()
106
106
Assert . AreEqual ( expectedLog , log . ToString ( ) ) ;
107
107
}
108
108
109
+ [ Test ]
110
+ public void ElementsCanEqual ( )
111
+ {
112
+ mockDriver . Setup ( _ => _ . FindElement ( It . Is < By > ( x => x . Equals ( By . Id ( "foo" ) ) ) ) ) . Returns ( mockElement . Object ) ;
113
+
114
+ EventFiringWebDriver firingDriver = new EventFiringWebDriver ( mockDriver . Object ) ;
115
+ var element1 = firingDriver . FindElement ( By . Id ( "foo" ) ) ;
116
+ var element2 = firingDriver . FindElement ( By . Id ( "foo" ) ) ;
117
+
118
+ Assert . AreEqual ( element1 , element2 ) ;
119
+ }
120
+
109
121
[ Test ]
110
122
public void ShouldFireFindByEvent ( )
111
123
{
You can’t perform that action at this time.
0 commit comments