admin管理员组

文章数量:1312825

I'm trying to the 'protractor.Key.DELETE' to make protractor press the delete key. Any thoughts on how to go about doing this? The following does not work for me:

browser.actions().keyDown(protractor.Key.DELETE).sendKeys().perform();

Protractor give me the following error message:

Failed: Not a modifier key

I'm trying to the 'protractor.Key.DELETE' to make protractor press the delete key. Any thoughts on how to go about doing this? The following does not work for me:

browser.actions().keyDown(protractor.Key.DELETE).sendKeys().perform();

Protractor give me the following error message:

Failed: Not a modifier key

Share Improve this question edited Mar 11, 2015 at 19:50 Feras Salim 4387 silver badges33 bronze badges asked Mar 11, 2015 at 19:45 Joseph FreemanJoseph Freeman 1,7944 gold badges26 silver badges50 bronze badges 3
  • possible duplicate of How to make protractor press the enter key? – alecxe Commented Mar 11, 2015 at 22:05
  • I've seen that post. Using an instance of Protractor doesn't seem to work for me. – Joseph Freeman Commented Mar 12, 2015 at 3:09
  • Okay, but what about browser.actions().sendKeys(protractor.Key.ENTER).perform();? – alecxe Commented Mar 12, 2015 at 3:10
Add a ment  | 

1 Answer 1

Reset to default 9

keyDown can only work for modifier keys, such as Alt, SHIFT, CONTROL. To make protractor press the DELETE key, you can use senKeys like this:

browser.actions().sendKeys(protractor.Key.DELETE).perform();

本文标签: javascriptAngularjs Protractor Test protractorKeyDELETEis this a proper modifier keyStack Overflow