You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by msr raju <ms...@gmail.com> on 2021/11/30 04:46:21 UTC

Work with Proxy Auto Configuration(PAC) in Jmeter

Hello,

Did anyone know how to work with PAC script in Jmeter, I know we can parse
the pac script manually and have the specific proxy host and port number
via command line or in properties file, but the flow which I  am trying to
test goes through multiple proxies, currently Jmeter takes only one proxy
host and port number, is there anyway we can programmatically parse the PAC
script and set the proxy details during the recording based on the request
address?

And we have restrictions in place to use "chrome extension recorder".

Thanks,
Siva

Re: Work with Proxy Auto Configuration(PAC) in Jmeter

Posted by Dmitri T <gl...@live.com>.
PAC script is basically a JavaScript file which exposes 
FindProxyForURL(url, host) function.

For replaying you can add a JSR223 PreProcessor 
<https://jmeter.apache.org/usermanual/component_reference.html#JSR223_PreProcessor> 
and run the script to determine the proxy before executing the request, 
save it into a JMeter Variable 
<https://jmeter.apache.org/usermanual/functions.html> and use this 
variable under proxy configuration section (lives under "Advanced" tab 
of the HTTP Request sampler)

If you need to record via corporate proxy using this PAC script - you 
can execute your scenario(s) in browser having "Network" tab of 
yourbrowser developer tools 
<https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools> 
open, this way you will have requests stored, the options will be in:

 1. Manually create HTTP Request samplers by looking at captured requests
 2. Use a tool like har2jmx <https://github.com/mingyuchoo/har2jmx>
 3. Use an online service like BlazeMeter Converter
    <https://converter.blazemeter.com/>


On 11/30/2021 5:46 AM, msr raju wrote:
> Hello,
>
> Did anyone know how to work with PAC script in Jmeter, I know we can parse
> the pac script manually and have the specific proxy host and port number
> via command line or in properties file, but the flow which I  am trying to
> test goes through multiple proxies, currently Jmeter takes only one proxy
> host and port number, is there anyway we can programmatically parse the PAC
> script and set the proxy details during the recording based on the request
> address?
>
> And we have restrictions in place to use "chrome extension recorder".
>
> Thanks,
> Siva
>