简体   繁体   English

单击输入以触发焦点事件

[英]Click an input to trigger focus event

I have an input with ng-focus="..." directive. 我有ng-focus="..."指令的输入。 I'm trying to get this input be focused by clicking on it but it seems does not work that way. 我正在尝试通过单击使其集中输入,但似乎不起作用。

I've tried to type something in it by sendKeys and then to click on it but I still see characters appear in the input but further clicking does not trigger a focus event. 我尝试通过sendKeys在其中键入某些sendKeys ,然后单击它,但是我仍然看到字符出现在输入中,但是进一步单击不会触发焦点事件。

input.sendKeys('0').then(function() {
    input.click().then(refreshModel).then(function (model) { // here I can see 0 in my input
        expect(...).toBe(...); // input does not get focused here
    });
});

If I click the input field my ng-focus is triggered, maybe some bug got fixed? 如果我单击输入字段,就会触发ng-focus,也许某些错误已得到解决?

this.testField = ptor.findElement(protractor.By.model('testModel'));
this.testField.click();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM