[英]How to install additional packages to jython jar in jmeter?
I am using jython inside jmeter by placing the jython.jar under "lib" folder of your JMeter installation. 我通过将jython.jar放在JMeter安装的“ lib”文件夹下,在jmeter中使用jython。 It runs successfully.
它运行成功。
But the problem is I can't install additional packages or modules of python inside it. 但是问题是我无法在其中安装其他软件包或python模块。 To be more specific, I want to run selenium in python inside jmeter, so needs selenium module needs to be installed in jython.
更具体地说,我想在jmeter中的python中运行selenium,因此需要在jython中安装selenium模块。
How should I do it? 我该怎么办?
You can install Jython packages normally, ie using pip , however make sure you are executing pip
which comes with Jython (located under "bin" folder of your Jython installation) 您可以正常安装Jython软件包,即使用pip ,但是请确保您正在执行Jython随附的
pip
(位于Jython安装的“ bin”文件夹下)
/temp/jython
/temp/jython
/temp/jython/bin
folder and execute ./pip install selenium
command /temp/jython/bin
文件夹并执行./pip install selenium
命令 Add the next line to user.properties file which is located in JMeter's "bin" folder: 将下一行添加到位于JMeter的“ bin”文件夹中的user.properties文件:
user.classpath=/temp/jython;/temp/jython/javalib
Note that JMeter restart will be required to pick the classpath up, check out Apache JMeter Properties Customization Guide for more information. 请注意,将需要重新启动JMeter才能拾取类路径,有关更多信息,请查看Apache JMeter属性定制指南 。
Add JSR223 Sampler and selenium jython
from the "Language" dropdown 添加JSR223采样和硒
jython
从“语言”下拉列表
Add the next lines at the beginning of your script: 在脚本的开头添加下一行:
import sys sys.path.append('/temp/jython/Lib') sys.path.append('/temp/jython/Lib/site-packages') import selenium
You should be good to go. 你应该很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.