You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.
var page *agouti.Page
...
Expect(page.FindById("foo").Click()).To(Succeed())
The issue appears to be that Agouti expects ChromeDriver to indicate errors with a non-2XX status code, while (at least my version of ChromeDriver) returns HTTP 200 even when a failure occurred.
It does not provide a pointer for the response.
Which results in the client not attempting to parse the response (aside from checking HTTP status code):
bodyValue := struct{
Status int `json:"status"`
Value interface{} `json:"value"`
}{}
if result != nil {
bodyValue.Value = result
}
if err := json.Unmarshal(responseBody, &bodyValue); err != nil {
return fmt.Errorf("unexpected response: %s", responseBody)
} else if bodyValue.Status != 0 {
return fmt.Errorf("unexpected response (nonzero status %d): %s", bodyValue.Status, responseBody)
}
I am not sure if this is an issue with ChromeDriver not not returning the correct HTTP status code, or if it's reporting errors in a valid way. For this reason I am not sure if it's safe to make this change or if it could cause issues with other browser drivers.
I am using ChromeDriver v 2.46 on macOS
The text was updated successfully, but these errors were encountered:
hasryan
changed the title
Click error from WebDriver not reportedClick on invisible element fails in Chrome but Agouti ignores error and returns success
Aug 29, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I wrote a test that attempted to click on an invisible element, and was surprised to find that the click did not return an error.
Example:
With this html:
This passes:
The issue appears to be that Agouti expects ChromeDriver to indicate errors with a non-2XX status code, while (at least my version of ChromeDriver) returns HTTP 200 even when a failure occurred.
I added some debug statements and found that the response from ChromeDriver does report this click error using the
status
property of the response as described here: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#response-status-codesFor the above example, it responded with the body:
My analysis:
When the click request is sent here:
agouti/api/element.go
Line 80 in 96599c9
It does not provide a pointer for the response.
Which results in the client not attempting to parse the response (aside from checking HTTP status code):
agouti/api/internal/bus/client.go
Line 29 in 96599c9
My fix replaced the following block of code from
agouti/api/internal/bus/client.go
Lines 29 to 34 in 96599c9
With this in its place:
I am not sure if this is an issue with ChromeDriver not not returning the correct HTTP status code, or if it's reporting errors in a valid way. For this reason I am not sure if it's safe to make this change or if it could cause issues with other browser drivers.
I am using ChromeDriver v 2.46 on macOS
The text was updated successfully, but these errors were encountered: