0

I am trying to access the 'successURL' element of a response payload in chrome console, but cannot work it out. I've tried everything I can think of --> payload.successUrl, e.payload.successUrl, data.payload, but can't seem to access the element.

Anyone able to help? Thanks!

Response payload in chrome tools

Matt
  • 41
  • 7
  • how did you end up having this object in the first place? could you provide more info, like a function that produces the object, or where it comes from, or how you are trying to get those values? – Tch Jan 24 '21 at 22:57
  • Thanks Tch - that question (along with webdev-dans) helped me answer my question. I need to parse the response before I send it to the console. Duh. Simple, rookie error. I'll update my question so it's clear. – Matt Jan 25 '21 at 00:16

2 Answers2

0

As you shown on image attached to your question - you have successfully accessed this in chrome console :) You can now right-click to see context-menu and copy it to a variable or do some other things.

But If what you mean is to access data from developer tools straight away in a script - it's rather impossible. For more information on that - read this aswered here: https://stackoverflow.com/a/50571792/3054380

If the request resulting with that payload data was made by your script - then you need to show how you did this - and surely it is quite simple to access any data recieved in response.

webdev-dan
  • 1,339
  • 7
  • 10
  • Thank you webdev-dan. You've saved me a lot of time messing around when the answer was at my fingertips. I'm pretty rusty at development. I'm including the answer to my question in case it helps anyone. – Matt Jan 25 '21 at 00:15
0

I found the answer in my question from webdev-dan and Tch (I can't upvote them as I don't have the reputation, sorry!). I was trying to access the response after it was posted to console as opposed to parsing the data in my script then sending to console.

Here is what I did to get the element from the response I needed (successUrl).

Javascript

  const result = await frui.getSession();

  console.log(result);
  console.log(result.payload);
  console.log(result.payload.successUrl);

Response in console

Response in console

I'll now set the result.payload.successUrl as a variable to use later on.

Matt
  • 41
  • 7