1

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 May 2 '18 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. May 2 '18 at 14:47
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.