File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
src/org/openqa/selenium/remote
test/org/openqa/selenium/remote Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 2424
2525import java .util .List ;
2626import java .util .Map ;
27+ import java .util .Objects ;
2728import org .openqa .selenium .By ;
2829import org .openqa .selenium .SearchContext ;
2930import org .openqa .selenium .WebDriver ;
@@ -69,4 +70,21 @@ public String getId() {
6970 private Map <String , Object > toJson () {
7071 return singletonMap (W3C .getShadowRootElementKey (), id );
7172 }
73+
74+ @ Override
75+ public boolean equals (Object o ) {
76+ if (this == o ) {
77+ return true ;
78+ }
79+ if (o == null || getClass () != o .getClass ()) {
80+ return false ;
81+ }
82+ ShadowRoot that = (ShadowRoot ) o ;
83+ return Objects .equals (parent , that .parent ) && Objects .equals (id , that .id );
84+ }
85+
86+ @ Override
87+ public int hashCode () {
88+ return Objects .hash (parent , id );
89+ }
7290}
Original file line number Diff line number Diff line change @@ -225,6 +225,6 @@ void shouldBeAbleToGetShadowRootFromExecuteScript() {
225225 ShadowRoot shadowContext = (ShadowRoot ) element .getShadowRoot ();
226226 ShadowRoot executeContext =
227227 (ShadowRoot ) ((JavascriptExecutor ) driver ).executeScript ("return Arguments[0].shadowRoot" );
228- assertThat (shadowContext . getId ()) .isEqualTo (executeContext . getId () );
228+ assertThat (shadowContext ) .isEqualTo (executeContext );
229229 }
230230}
You can’t perform that action at this time.
0 commit comments