etaoin
etaoin copied to clipboard
How to get status code.
How to get status code after i executed go function?
@Atsman briefly, it requires some tweaks described there: https://stackoverflow.com/questions/6509628/how-to-get-http-response-code-using-selenium-webdriver-with-java
Currently, you may set your own LogType preferences passing some particular capabilities
value. The issue you've created is to process log-type key.
I can confirm that I've been able to retrieve http response status from chrome perf logs using the solution in the stackoverflow link posted, but it took ages of poking around, passing the right flags into chromedriver, then retrieving and parsing the logs themselves.
It's a pleasure using this library!
https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-responseReceivedExtraInfo
Since now we got this api (though marked as experimental), maybe we can add the related data to the etaoin.dev/get-requests
result? Maybe enable this behavior via some experimental option?
Thanks for the comment @lotuc!
I'll re-open this issue so we don't forget about it.
So, @lotuc this isn't part of the w3c spec, and is experimental, so we probably won't include it in the etaoin API.
But... if you can provide me with a working code example, it might be nice to include it in the user guide of something browser-custom folks can do.
OK, here is my dirty patch gist. I just copy the whole etaoin.dev. The changed part is Line 70 - Line 75 & Line 90 - Line 94.
Sample:
(def d (etaoin.api/chrome {:dev {}}))
(etaoin.api/go d "https://www.bing.com")
(def requests (etaoin.dev-patch/get-requests d)) ;; replace the etaoin.dev
(-> (first requests) :response :status-code) ;; the :status-code is only added compare to original etaoin.dev/get-requests
;; we get the status code here
Thanks @lotuc!
I kinda sorta forgot we have a dedicated namespace to support chrome dev tools.
Once this moves out of the experimental state your gist will be a nice headstart on incorporating this.