2

I'm trying to simulate browser post request using python requests module. The problem is that I don't know how to get one variable that browser is getting from javascript (don't have any knowledge in it) of the site. Here is this part:

t.userid = Storages.sessionStorage.get("user").id

Is there any way I can get it?

P.S. As I understand that variable is stored in the session storage, and I am not sure if it is possible to get through requests, may be I should use selenium to get it? If yes how I can do that?

2
  • What is that code? How does it relate to anything? What is t, and what does it do with userId? What are you trying to do? What should the result be? Commented May 25, 2017 at 13:29
  • There is javascript code that forming post request, I'm trying to simulate it. I have all variables except one (userid) and code above is forming that variable, that is what I have found in that javascript. More code from that function to undestand what is 't': function l(e) { var t = {}, u = cleanFileName(e.name); t.video = e, t.name = u, t.userid = Storages.sessionStorage.get("user").id, ... Commented May 25, 2017 at 15:00

1 Answer 1

4

Found the solution. I got this variable using selenium:

driver.execute_script("return sessionStorage.getItem('user');");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.