简体   繁体   English

有没有办法在 JMeter 的 Selenium Webdriver Sampler 中获取线程 ID?

[英]Is there a way to get the thread-id in Selenium Webdriver Sampler for JMeter?

I need to get the id/number of the actual thread in my Webdriver Sampler code.我需要在我的 Webdriver Sampler 代码中获取实际线程的 ID/编号。 Is there a way to identify the thread the code is run from?有没有办法识别代码运行的线程?

There is WDS.ctx shorthand which stands for JMeterContext class instance so you should be able to use getThreadNum() function in order to obtain current thread (virtual user) number:WDS.ctx简写代表JMeterContext class 实例,因此您应该能够使用getThreadNum() function 以获得当前线程(虚拟用户)编号:

var threadID = WDS.ctx.getThreadNum()

Demo:演示:

在此处输入图像描述

More information: The WebDriver Sampler: Your Top 10 Questions Answered更多信息: WebDriver 采样器:您回答的 10 大问题

UsethreadNum or ThreadGroupName which ever suits your purpose.使用适合您目的的threadNumThreadGroupName Please check the below snapshot for using it in webdriver sampler;-请检查以下快照以在 webdriver 采样器中使用它;-

在此处输入图像描述

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM