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

查看:295
本文介绍了如何在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');
  • 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.

Dependencies:

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

Driver versions affected:

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

.keys()命令出了什么问题?

  • 这是整个Selenium社区中的一个已知问题,只有在驱动程序(chromedrivergeckodriver等)实现Webdriver的新W3C标准以用于用户输入时,WebdriverIO才会修复/解决该问题, 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天全站免登陆