I have to select two dates (date_from and date_to) in a pop-up window. The only way doing step-by-step with the mouse is by clicking in each calendar icon (see image) and picking the date from there. I'd like to set those values in the site with already selected dates.

enter image description here

Here is the HTML code (date_from):

<div class="field">
<i class="icon-append fa fa-calendar" ng-click="ParameterExportModal.openCalendar($event, 'from')"></i>
<input type="text" class="field" value="-" readonly="readonly">
<input id="from" type="text" class="form-control ng-untouched ng-isolate-scope ng-valid-date ng-dirty ng-empty ng-invalid ng-invalid-required" style="display: none;" datepicker-popup="" is-open="ParameterExportModal.datepickers.from" ng-model="ParameterExportModal.form.start" close-text="Close" ng-required="true" required="required">
<!-- ngIf: isOpen -->
<span class="msg ng-scope" translate="invalid.field">Please enter a valid value</span>

I tried changing as I did previously to log in the site:

date_from = driver.find_element_by_xpath("//input[@id='from']")

But then I received this error message: "TypeError: 'module' object is not callable"

And just something that I noticed, the line that contains the id field of the HTML code of both input's is gray. I don't know if this impacts on something. Here it is how it looks like:

enter image description here

Any help would be greatly appreciated!

1 Answers

supputuri On Best Solutions

"TypeError: 'module' object is not callable" error nothing to do with the calendar. make sure you call the method correctly.

For example if you try to call time(2) that will cause this kind of error, you have to call time.sleep(2).