I'm using datepicker from angular UI bootstrap lib. https://angular-ui.github.io/bootstrap/#/Datepicker
after select date, I'm not able to get the text of input using JQuery expression. $('#effectiveDate').text() is always returning empty, but I can see it has value on the page.
What can I do to retrieve this value?
updates: in chrome console,
$('#effectiveDate') returns:
[<input id="effectiveDate" name="effectiveDate" type="text" class="form-control pickdaterInput ng-valid ng-isolate-scope ng-valid-date ng-dirty ng-valid-parse ng-touched" datepicker-popup="dd-MMMM-yyyy" ng-model="elt.registrationState.effectiveDate" is-open="opened" min-date="minDate" datepicker-options="dateOptions" close-text="Close">]
$('#effectiveDate').text(); returns;
""
angular.element($0).scope().elt.registrationState.effectiveDate returns:
Tue Jul 14 2015 00:00:00 GMT-0400 (Eastern Daylight Time)
but in Selenium:
JavascriptExecutor js = (JavascriptExecutor) driver;
String effectiveDate_string = js.executeScript("angular.element($0).scope().elt.registrationState.effectiveDate.getTime().toString()").toString();
gives error:
org.openqa.selenium.WebDriverException: unknown error: $0 is not defined
(Session info: chrome=43.0.2357.132)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9 milliseconds