Search code examples
seleniumselenium-webdriversafariprotractorend-to-end

error while sending text to div field in Safari using protractor


I've got a text area div field:

<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>

I'm able to use sendKeys in chrome using:

element(by.css('div#shortansweractivityId')).sendKeys('Test');

But when run the same in safari it errors out:

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

Any suggestions?


Solution

  • Made it work in safari using jquery in browser.executeScript().