Selenium sendKeys are not sending all characters

前端 未结 7 1700
面向向阳花
面向向阳花 2021-02-02 15:29

I\'m using Java, Selenium, and Chrome for test automation. Our developers recently upgraded our UI from AngularJS to Angular2 (not sure if that matters). But since then, sendKey

相关标签:
7条回答
  • 2021-02-02 16:30

    I stumbled upon this error when doing integration tests with NightwatchJS (which uses selenium).

    So I'm writing this for people coming here in the future.

    I wrote this extension command for nightwatch:

    exports.command = function (selector, value, using) {
        var self = this;
        self.elements(using || 'css selector', selector, function (elems) {
            elems.value.forEach(function (element) {
                for (var c of value.split('')) {
                    self.elementIdValue(element.ELEMENT, c);
                }
            });
        });
        return this;
    };
    

    Which can be used in this way:

    var username = 'integration@test.com';
    browser.setValueSlow('input[ngcontrol=username]', username); //Works with ng2!
    

    This issue was also discussed on NightwatchJS's github here

    0 讨论(0)
提交回复
热议问题