简体   繁体   English

在 JMeter WebDriver 采样器中使用 sendKeys 命令进行“多个同时按键”操作

[英]Using sendKeys command for "multiple, simultaneous key press" actions in JMeter WebDriver sampler

I am trying to perform a multi key press action on Guidewire applications using JMeter WebDriver.我正在尝试使用 JMeter WebDriver 在 Guidewire 应用程序上执行多键按下操作。 Find the below samples查找以下示例

  1. Alt + Shift + T Alt + Shift + T
  2. Alt + Shift + P Alt + Shift + P

I guess Selenium allows key press only for special and function keys我猜 Selenium 只允许按下特殊键和功能键

Is there a way to achieve this?有没有办法实现这一目标?

Action class might help you.行动课可能会帮助你。

Actions keypress= new Actions(driver); 
Action seriesOfActions = keypress
   .keyDown(webelement, Keys.SHIFT) 
   .keyDown(webelement, Keys.ALT+T) 
    .build(); 
   SeriesOfActions.perform(); 

options 2 is to use Robot class: How to press CTRL+T and CTRL+TAB in selenium WebDriver using Java?选项 2 是使用 Robot 类: How to press CTRL+T and CTRL+TAB in selenium WebDriver using Java?

Use Actions and Keys.chord combination like:使用ActionsKeys.chord组合,如:

var keys = org.openqa.selenium.Keys
new org.openqa.selenium.interactions.Actions(WDS.browser).sendKeys(keys .chord(keys .ALT, keys .SHIFT, "P")).build().perform()

More information on WebDriver sampler tips and tricks: The WebDriver Sampler: Your Top 10 Questions Answered有关 WebDriver 采样器提示和技巧的更多信息: WebDriver 采样器:您回答的前 10 个问题

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

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