使用量角器将文本发送到 Safari 中的 div 字段时出错
error while sending text to div field in Safari using protractor
我有一个文本区域 div 字段:
<div id="shortansweractivityId" class="shortanswerText ng-pristine ng-scope ng-isolate-scope ng-invalid ng-invalid-required ng-touched" ng-model="activity.answer" ng-if="isEditable" ng-focus="editing()" placeholder="Write here..." contenteditable="true" content-type="text"></div>
我可以在 chrome 中使用 sendKeys
使用:
element(by.css('div#shortansweractivityId')).sendKeys('Test');
但是当 运行 在 safari 中相同时它会出错:
UnknownError: undefined is not an object (evaluating 'b.value.length')
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 18 milliseconds Build info: version:
'2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System
info: host: 'spatchamatla-mac.local', ip: '10.29.1.136', os.name: 'Mac
OS X', os.arch: 'x86_64', os.version: '10.10.3', java.version:
'1.8.0_45' Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{browserName=safari, takesScreenshot=true,
javascriptEnabled=true, version=8.0.6, cssSelectorsEnabled=true,
platform=MAC, secureSsl=true}] Session ID: null
有什么建议吗?
使用 browser.executeScript()
中的 jquery
在 safari 中运行。
我有一个文本区域 div 字段:
<div id="shortansweractivityId" class="shortanswerText ng-pristine ng-scope ng-isolate-scope ng-invalid ng-invalid-required ng-touched" ng-model="activity.answer" ng-if="isEditable" ng-focus="editing()" placeholder="Write here..." contenteditable="true" content-type="text"></div>
我可以在 chrome 中使用 sendKeys
使用:
element(by.css('div#shortansweractivityId')).sendKeys('Test');
但是当 运行 在 safari 中相同时它会出错:
UnknownError: undefined is not an object (evaluating 'b.value.length') (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 18 milliseconds Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System info: host: 'spatchamatla-mac.local', ip: '10.29.1.136', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.3', java.version: '1.8.0_45' Driver info: org.openqa.selenium.safari.SafariDriver Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=8.0.6, cssSelectorsEnabled=true, platform=MAC, secureSsl=true}] Session ID: null
有什么建议吗?
使用 browser.executeScript()
中的 jquery
在 safari 中运行。