Access to local storage data.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Access to local storage data.

Dhruv Arora
I am working on a project where auth key is stored in browser local
storage. Can someone explain how it works with jmeter. How can i access it?

Regards
Dhriv
Reply | Threaded
Open this post in threaded view
|

Re: Access to local storage data.

Himanshu Ghai
can you write a java program to access it and use it in beanshell

On Thu, May 30, 2019 at 11:16 AM Dhruv Arora <[hidden email]>
wrote:

> I am working on a project where auth key is stored in browser local
> storage. Can someone explain how it works with jmeter. How can i access it?
>
> Regards
> Dhriv
>
Reply | Threaded
Open this post in threaded view
|

Re: Access to local storage data.

Dhruv Arora
Can you explain a bit more Re:"can you write a java program to access it and use it in beanshell". This token in dynamic, and is created afresh with SSO.What you wanna say is to replicate the logic of creating token in java code and use it via beanshell? Sent from my Samsung Galaxy smartphone.
-------- Original message --------From: Himanshu Ghai <[hidden email]> Date: 30/05/2019  23:58  (GMT+05:30) To: JMeter Users List <[hidden email]> Subject: Re: Access to local storage data. can you write a java program to access it and use it in beanshellOn Thu, May 30, 2019 at 11:16 AM Dhruv Arora <[hidden email]>wrote:> I am working on a project where auth key is stored in browser local> storage. Can someone explain how it works with jmeter. How can i access it?>> Regards> Dhriv>
Reply | Threaded
Open this post in threaded view
|

Re: Access to local storage data.

glinius@live.com
In reply to this post by Dhruv Arora
As per JMeter project main page <http://jmeter.apache.org/>  :




> JMeter is not a browser, it works at protocol level. As far as
> web-services and remote services are concerned, JMeter looks like a
> browser (or rather, multiple browsers); however JMeter does not perform
> all the actions supported by browsers. In particular, JMeter does not
> execute the Javascript found in HTML pages. Nor does it render the HTML
> pages as a browser does (it's possible to view the response as HTML etc.,
> but the timings are not included in any samples, and only one sample in
> one thread is ever displayed at a time).

So if you have the value somewhere in browser session - just extract it
using  browser developer tools
<https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools>  
and add to JMeter script.

If you're working on JMeter integration with  Selenium
<https://www.seleniumhq.org/>  via  WebDriver Sampler
<https://www.blazemeter.com/blog/jmeter-webdriver-sampler>   - be aware that
you can manupulate  window.localStorage object
<https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage>  
using JavaScript like:


> //set value:
> WDS.browser.executeScript("localStorage.setItem('foo', 'bar')")
> //get value:
> var foo = WDS.browser.executeScript("return localStorage.getItem('foo');")

<http://www.jmeter-archive.org/file/t340375/foo.png>





--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Access to local storage data.

Himanshu Ghai
In reply to this post by Dhruv Arora
You got it. If the token is generated with sso. I guess you can either make
those requests part of your flow. Or if your tokens live long save them to
a file

On Thu, May 30, 2019 at 11:48 AM 21.dhruvarora <[hidden email]>
wrote:

> Can you explain a bit more Re:"can you write a java program to access it
> and use it in beanshell". This token in dynamic, and is created afresh with
> SSO.What you wanna say is to replicate the logic of creating token in java
> code and use it via beanshell? Sent from my Samsung Galaxy smartphone.
> -------- Original message --------From: Himanshu Ghai <
> [hidden email]> Date: 30/05/2019  23:58  (GMT+05:30) To: JMeter
> Users List <[hidden email]> Subject: Re: Access to local storage
> data. can you write a java program to access it and use it in beanshellOn
> Thu, May 30, 2019 at 11:16 AM Dhruv Arora <[hidden email]>wrote:>
> I am working on a project where auth key is stored in browser local>
> storage. Can someone explain how it works with jmeter. How can i access
> it?>> Regards> Dhriv>