I am using jython inside jmeter by placing the jython.jar under "lib" folder of your JMeter installation. It runs successfully.
But the problem is I can't install additional packages or modules of python inside it. To be more specific, I want to run selenium in python inside jmeter, so needs selenium module needs to be installed in jython.
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)
/temp/jython
/temp/jython/bin
folder and execute ./pip install selenium
command Add the next line to user.properties file which is located in JMeter's "bin" folder:
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.
Add JSR223 Sampler and selenium jython
from the "Language" dropdown
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.