Selenium webdriver (javascript) tab out

后端 未结 1 1229
感动是毒
感动是毒 2021-01-20 04:10

While filling out a form the test needs to tab out in order to go to next field.

The error I get is:

 InvalidArgumentError: Not a modifier key


        
相关标签:
1条回答
  • 2021-01-20 04:57

    The keyDown action is only for modifier keys :

    key.CONTROL
    key.SHIFT
    key.ALT
    key.COMMAND
    

    To send the tab key, use .sendKeys:

    var key = require('selenium-webdriver').Key;
    var actionSequence = require('selenium-webdriver').ActionSequence;
    
    new actionSequence(driver).keyDown(key.CONTROL).sendKeys(key.TAB).perform().then(function(){
        console.log("Done selection?");
    });
    
    0 讨论(0)
提交回复
热议问题