Mayzhou
Mayzhou

Reputation: 31

Protractor When sendKeys meet issue 'cannot focus element'

I am not sure if Protractor can sendKeys to a div.

My code is

element(by.css('.create-api-schema-editor .CodeMirror .CodeMirror-lines .CodeMirror-code .CodeMirror-line')).sendKeys(content);

I also tried click first and then sendKeys, but no luck.

HTML is: enter image description here

Upvotes: 0

Views: 402

Answers (1)

Mayzhou
Mayzhou

Reputation: 31

I fixed the issue, we can use browser.actions().click().perform() instead of ele.click().

I am not sure why but it works.

Hope this helpful for you.

Upvotes: 2

Related Questions