如何在 WebdriverIO 中点击 CTRL+M (Control + M) [英] How to click on CTRL+M (Control + M) in WebdriverIO

查看:30
本文介绍了如何在 WebdriverIO 中点击 CTRL+M (Control + M)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在 WebdriverIO 中发出 CTRL+M 操作,但它不起作用.

I have to issue a CTRL+M action in WebdriverIO, but it is not working.

我尝试过使用不同的方法,例如:

I have tried using different ways such as:

  • browser.keys('Control').keys('m');
  • browser.keys(['Control','KeyM', 'NULL']);
  • browser.keys(['Control', 'm', 'NULL']);
  • browser.keys('Control').keys('KeyM');
  • browser.deviceKeyEvent(82);browser.pressKeycode(82);browser.keys('MENU');

以上都不起作用.有人可以帮我吗?

None of the above are working. Can anyone help me?

推荐答案

简短回答,.您目前无法将按键命令与任何驱动程序配置链接起来..keys() 实际上仍然可以与 chromedriver 一起使用(仅发送文本,没有链接),但它已被标记为弃用.有关详细信息,请参阅下面的列表.

Short answer, NO. You currently cannot chain key commands with any driver configuration. .keys() does in fact still work with chromedriver(only sending text, no chaining), yet it has been marked for deprecation. See list bellow for more details.

依赖:

"selenium-standalone": "^5.11.2",
"wdio-selenium-standalone-service": "0.0.8",
"webdriverio": "4.8.0"

受影响的驱动程序版本:

ChromeDriver: 2.29-x64-chromedriver
GeckoDriver:  0.16.0-x64-geckodriverIEDriver:
3.4.0-x64-IEDriverServer

.keys() 命令有什么问题?

  • 这是整个 Selenium 社区的一个已知问题,在驱动程序(chromedrivergeckodriver 等)实施 Webdriver 的新版本之前,不会在 WebdriverIO 中修复/解决用户输入的 W3C 标准,Actions API;
  • 没有其他方法可以做到这一点(相信我,我试过了!),除非您实际上可以通过代码替换 CTRL + M 操作的功能;
  • 这里有一个 BUG,记录了 GeckoDriver (Firefox) 的这个问题;
  • 即使 .keys() 方法适用于您当前的版本,Christian-Bromann 确认它将在下一个版本中弃用(它也被标记为/lib/protocol/keys.js 定义文件中的弃用).
  • this is a known issue throughout the Selenium community and won't be fixed/tackled in WebdriverIO until the drivers (chromedriver, geckodriver, etc.) implement Webdriver's new W3C standard for user input, Actions API;
  • there is not other way of doing this (trust me, I tried!), unless you can actually substitute the functionality of your CTRL + M action via code;
  • here is a BUG that documents this issue for GeckoDriver (Firefox);
  • even if the .keys() method is working with your current version, Christian-Bromann confirmed it will be deprecated in the next release (it is also marked for deprecation in the /lib/protocol/keys.js definition file).

注意:对于不同 WDIO 命令有类似问题的任何人,.keys()(WDIO), .sendKeys()(WebdriverJS) 也适用于其他损坏的 WebdriverIO 方法,例如 .moveTo().在此处阅读更多相关信息.

Note: For anyone having similar issues with different WDIO commands, the deprecation of .keys()(WDIO), .sendKeys()(WebdriverJS) also applies to other broken WebdriverIO methods like .moveTo(). Read more about it here.

这篇关于如何在 WebdriverIO 中点击 CTRL+M (Control + M)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆