Skip to content

Changed selenium api #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions remote_driver_element.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ import (
)

type findElementResponse struct {
E element `json:"value"`
E map[string]string `json:"value"`
}

type findElementsResponse struct {
E []element `json:"value"`
}

type element struct {
ID string `json:"element"`
E map[string]string `json:"value"`
}

func (s *seleniumWebDriver) FindElement(by By) (Element, error) {
Expand Down Expand Up @@ -45,9 +41,11 @@ func (s *seleniumWebDriver) FindElement(by By) (Element, error) {
if err != nil {
return nil, newUnmarshallingError(err, "FindElement", string(resp))
}

el := newSeleniumElement(response.E.ID, s)
return el, nil

for _, value := range response.E {
return newSeleniumElement(value, s), nil
}
return nil, errors.New("Not Found")
}

func (s *seleniumWebDriver) FindElements(by By) ([]Element, error) {
Expand Down Expand Up @@ -78,9 +76,9 @@ func (s *seleniumWebDriver) FindElements(by By) ([]Element, error) {
return nil, newUnmarshallingError(err, "FindElements", string(resp))
}

elements := make([]Element, len(response.E))
for i := range response.E {
elements[i] = newSeleniumElement(response.E[i].ID, s)
var elements []Element
for _, el := range response.E {
elements = append(elements, newSeleniumElement(el, s))
}

return elements, nil
Expand Down