“JMETER | Selenium WebDriver | 多线程未正常运行”

huangapple go评论62阅读模式
英文:

JMETER | Selenium WebDriver | Multiple threads are not running properly

问题

我正在尝试在JMeter中使用WebDriver Sampler来运行5 - 10个用户。我已经配置了Chrome Driver并提供了WebDriver Sampler的代码。当我为1个用户运行时,一切都运行得很正常。但对于多个用户,测试在某些地方失败,无法定位某些下拉菜单。只有一个线程通过,其他的都失败了。是否有办法在后台运行多个线程?

JMeter配置结构

我已经尝试过使用WebDriver Sampler来运行5 - 10个用户。对于1个用户来说是正常的。希望其他线程也有相同的行为。否则,如何在无界面模式下运行相同的代码。

英文:

I am trying to run for 5 - 10 users using WebDriver Sampler in JMeter. I have configured Chrome Driver and provided WebDriver Sampler for code. When I am running for 1 user, it is running perfectly fine. But for multiple users, test is failing at some point where it is unable to locate some dropdowns. Only 1 thread is passed and others are getting failed. Is there any way to run for multiple threads in background?

Structure of JMeter configuration

I have tried WebDriver Sampler for 5 - 10 users. It is passing for 1. Expecting the same behavior for other threads as well. Else, how to run the same code in Headless.

答案1

得分: 0

不要使用Selenium进行性能测试。

Selenium网站引用:

> 通常不建议使用Selenium和WebDriver进行性能测试。这不是因为它无法完成,而是因为它未经优化,因此您不太可能获得良好的结果。

JMeter插件网站引用:

> 注意:本项目的目标不是替代JMeter中包含的HTTP Samplers。相反,它旨在通过测量最终用户的加载时间来补充它们。

因此,我建议不要尝试使用多个浏览器解决问题,而是建议切换到HTTP协议并配置JMeter以像真正的浏览器一样运行


关于您的问题本身:

  • 确保您的计算机具有足够的资源,例如Firefox 114每个实例需要1个CPU核心和2 GB的RAM,因此如果您的计算机内存少于24 GB,我不建议同时启动10个浏览器。

  • 如果“下拉菜单”不立即可用,您可能需要增加默认的超时时间或使用Selenium 等待

英文:

Don't use Selenium for performance testing.

Quote from Selenium website:

>Performance testing using Selenium and WebDriver is generally not advised. Not because it is incapable, but because it is not optimised for the job and you are unlikely to get good results.

Quote from JMeter Plugins website:

>Note: It is NOT the intention of this project to replace the HTTP Samplers included in JMeter. Rather it is meant to compliment them by measuring the end user load time.

So instead of trying to resolve your issue with multiple browsers I would rather recommend switching to HTTP protocol and configure JMeter to behave like a real browser


With regards to your questions itself:

  • Make sure your computer has enough resources, for example Firefox 114 requires 1 CPU core and 2 GB or RAM per instance so if your machine has less than 24 GB of RAM I wouldn't recommend kicking off 10 browsers in parallel
  • If "dropdowns" are not available immediately you might want to increase default timeouts or use Selenium Waits

huangapple
  • 本文由 发表于 2023年6月8日 23:40:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76433561.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定