Skip to content

Commit

Permalink
Fix broken 'for' loops in FindElements methods.
Browse files Browse the repository at this point in the history
Previously the code was updating a copy of each element rather than
the element in the array.
  • Loading branch information
stp-ekioh committed Jul 8, 2024
1 parent 4d5165f commit da40194
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions element.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ func (e *Element) FindElements(strategy LocatorStrategy, selector string) ([]Ele
return nil, err
}

for _, element := range elements {
element.SessionID = e.SessionID
element.client = e.client
for index, _ := range elements {

Check failure on line 77 in element.go

View workflow job for this annotation

GitHub Actions / build

File is not `gofmt`-ed with `-s` (gofmt)
elements[index].SessionID = e.SessionID
elements[index].client = e.client
}

return elements, nil
Expand Down
6 changes: 3 additions & 3 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ func (s *Session) FindElements(strategy LocatorStrategy, selector string) ([]Ele
return nil, err
}

for _, element := range elements {
element.SessionID = s.ID
element.client = s.client
for index, _ := range elements {

Check failure on line 303 in session.go

View workflow job for this annotation

GitHub Actions / build

File is not `gofmt`-ed with `-s` (gofmt)
elements[index].SessionID = s.ID
elements[index].client = s.client
}

return elements, nil
Expand Down
6 changes: 3 additions & 3 deletions shadowroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func (s *ShadowRoot) FindElements(strategy LocatorStrategy, selector string) ([]
return nil, err
}

for _, element := range elements {
element.SessionID = s.ID
element.client = s.client
for index, _ := range elements {

Check failure on line 48 in shadowroot.go

View workflow job for this annotation

GitHub Actions / build

File is not `gofmt`-ed with `-s` (gofmt)
elements[index].SessionID = s.ID
elements[index].client = s.client
}

return elements, nil
Expand Down

0 comments on commit da40194

Please sign in to comment.