I have a complex javascript-intensive application I wish for which I wish to use python and selenium for automated testing. However, at the same time I need to have access to the http headers for both the request and response so I can do some security analysis as well.
Is there a way to integrate the use of selenium with the requests module so I have the best of both worlds?
-
This might be helpful for you stackoverflow.com/questions/5799228/…HaC– HaC2018年05月02日 04:52:41 +00:00Commented May 2, 2018 at 4:52
-
It's possible with Selenium. Either use a proxy server to intercept the requests or launch the browser with a custom webextension to capture the requests/responses.Florent B.– Florent B.2018年05月02日 14:47:08 +00:00Commented May 2, 2018 at 14:47
1 Answer 1
Selenium is an e2e
testing solution which works well with what is happening in browsers. It automates anything working in browser- mimicking what the users would try to do.
Instead of combining the API tests in Selenium and checking for the headers, you should have a different set up for API Testing, using Python requests
module or Chakram
in JS.
It's a bad idea to combine two different types of tests in same.
Explore related questions
See similar questions with these tags.