Jmeter/selenium-如何访问特定端点

发布于 2025-02-10 10:00:45 字数 737 浏览 3 评论 0原文

我在应用程序中有一个简单的性能测试流。

  1. 登录过程
  2. 1
  3. Process2
  4. Process3
  5. 注销

我正在使用Jmeter/Selenium进行性能测试。我目前正在调试Process3(“/示例/路径”)中的端点。问题在于,我必须运行整个自动化,才能在Process3中到达该端点。有没有办法跳过过程并导航到该特定端点(不是无头)?例如:

WDS.sampleResult.sampleStart();
WDS.browser.get("https://domain/path/path/endpoint");

//Authentication
implicitFind(pkg.By.id("username")).sendKeys("user");
implicitFind(pkg.By.id("password")).sendKeys("password");
implicitFind(pkg.By.id("login")).click();

//below code would be for debugging endpoint in UI

当我运行WebDriver采样器时,它会显示登录页面,我不介意要求登录。但是,在我登录后,WebApp不会转到端点并抛出NullPoInterException。我需要添加cookie经理吗?如果是这样,我该如何使用WebDriver采样器进行此操作。如果没有,是否有另一种成功实现这一目标的方法?提前致谢。

I have a simple performance test flow in an application.

  1. Login
  2. Process1
  3. Process2
  4. Process3
  5. Logout

I am using Jmeter/Selenium to do a performance testing. I am currently debugging an endpoint in Process3("/example/path"). The problem is that I have to run the entire automation for me to get to that endpoint in Process3. Is there a way to skip the processes and navigate to that specific endpoint(not headless)? For example:

WDS.sampleResult.sampleStart();
WDS.browser.get("https://domain/path/path/endpoint");

//Authentication
implicitFind(pkg.By.id("username")).sendKeys("user");
implicitFind(pkg.By.id("password")).sendKeys("password");
implicitFind(pkg.By.id("login")).click();

//below code would be for debugging endpoint in UI

When I run WebDriver Sampler, it presents the login page, which I do not mind asking to login. But after I login, webapp does not go to endpoint and throws a NullPointerException. Would I need to add a Cookie Manager? If so, how would I go with doing this using a WebDriver Sampler. If no, is there another way to successfully achieve this? Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

塔塔猫 2025-02-17 10:00:45

如果应用程序在登录后不能正确地将您重定向到“端点” - 仅是您的应用程序问题,那么您在Jmeter或硒级别上无能为力。

您需要仅运行进程3并跳过过程1和进程2仅使用“禁用”或“切换”上下文菜单操作暂时禁用它们,

“在此处输入映像”

您可以看到“灰色”采样器不在执行。

htttp cookie Manager a href =“ https://jmeter.apache.org/usermanual/component_reference.html#http_request” rel =“ nofollow noreferrer”> http request 样本采样器, https://www.selenium.dev/ 是一个浏览器自动化框架,浏览器cookie自动

If the application doesn't properly redirect you to the "endpoint" after logging in - it's your application problem only, there is nothing you can do about it on JMeter or Selenium level.

It you want to run Process 3 only and skip Process 1 and Process 2 just temporarily disable them using "Disable" or "Toggle" context menu actions

enter image description here

As you can see the "greyed out" samplers are not executed.

HTTP Cookie Manager relates only to HTTP Request samplers, https://www.selenium.dev/ is a browser automation framework and browsers handle cookies automatically

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文