question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with datePicker

See original GitHub issue

In the application I need to click through with pywinauto, I have the Date Picker, which looks in the interface just like drop down box, which is empty on default, when you click the drop-down arrow, then calendar is showing up and you can select the date.

The controls detected by pywinauto look like this:

|    |    |    |    |    | Pane - 'gcDateAndTime'    (L230, T239, R615, B425)
|    |    |    |    |    | ['gcDateAndTime', 'gcDateAndTimePane', 'Pane19']
|    |    |    |    |    | child_window(title="gcDateAndTime", auto_id="gcDateAndTime", control_type="Pane")
|    |    |    |    |    |    | 
|    |    |    |    |    |    | Pane - ''    (L232, T260, R613, B423)
|    |    |    |    |    |    | ['10', 'Pane20']
|    |    |    |    |    |    | child_window(auto_id="searchDateAndTimeControl1", control_type="Pane")
|    |    |    |    |    |    |    | 
|    |    |    |    |    |    |    | Pane - ''    (L417, T279, R502, B299)
|    |    |    |    |    |    |    | ['11', 'Pane21']
|    |    |    |    |    |    |    | child_window(auto_id="datePickerTo", control_type="Pane")
|    |    |    |    |    |    |    |    | 
|    |    |    |    |    |    |    |    | Pane - ''    (L421, T282, R482, B296)
|    |    |    |    |    |    |    |    | ['12', 'Pane22']
|    |    |    |    |    |    |    |    | child_window(auto_id="4720152", control_type="Pane")
|    |    |    |    |    |    |    |    | 
|    |    |    |    |    |    |    |    | Custom - ''    (L421, T282, R482, B296)
|    |    |    |    |    |    |    |    | ['13', 'Custom29']
|    |    |    |    |    |    |    | 
|    |    |    |    |    |    |    | Pane - ''    (L320, T279, R405, B299)
|    |    |    |    |    |    |    | ['14', 'Pane23']
|    |    |    |    |    |    |    | child_window(auto_id="datePickerFrom", control_type="Pane")
|    |    |    |    |    |    |    |    | 
|    |    |    |    |    |    |    |    | Pane - ''    (L324, T282, R385, B296)
|    |    |    |    |    |    |    |    | ['15', 'Pane24']
|    |    |    |    |    |    |    |    | child_window(auto_id="5112538", control_type="Pane")
|    |    |    |    |    |    |    |    | 
|    |    |    |    |    |    |    |    | Custom - ''    (L324, T282, R385, B296)
|    |    |    |    |    |    |    |    | ['16', 'Custom30']`

Also in inspect.exe it looks strange for me. All 3 of the components (for example datePickerFrom and his children), have LegacyAccesible.Name and LegacyAccessible.Value set on “Friday, August 17, 2018” (today), and all of them have role “drop down”, and state “focused,focusable”. Poping up the Calendar doesn’t seem to be noticed by inspect.exe. When I set the date, the values and names are changed for the components.

Is it normal that it looks like this, or it seems like a problem with access to the component? I am newbie to pywinauto, but I feel like some components are missing here. I tried to use methods click/click_input/invoke/set_text on these components (datePickerFrom/To and their children), but nothing works. Is it possible to select the date with pywinauto in this case?

I’m using backend=“uia”, pywinauto ver.0.6.5, python 3.7.0 Please advice me something.

Thank you!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jrgdiazcommented, Mar 9, 2022

Looks like DateTimePickerWrapper is not implemented in UIA backend. And this particular control is detected as Pane anyway. But if this control has NativeWindowHandle property in Inspect.exe, it’s possible to re-use wrapper from “win32” backend (at least try this). This should look so:

from pywinauto.controls.common_controls import DateTimePickerWrapper

dateTimeFrom_win32 = DateTimePickerWrapper(dateTimeFrom_wrapper.handle)
dateTimeFrom_win32.set_time(year=2017, month=5, day=23) # if it's date only control (or see full params list)

Hello, sorry to comment on this closed issue, i was struggling with this same problem and successfully tried this method. So just wanted to say that re-using win32 backend worked for me in the end.

1reaction
vasily-v-ryabovcommented, Aug 17, 2018

Looks like DateTimePickerWrapper is not implemented in UIA backend. And this particular control is detected as Pane anyway. But if this control has NativeWindowHandle property in Inspect.exe, it’s possible to re-use wrapper from “win32” backend (at least try this). This should look so:

from pywinauto.controls.common_controls import DateTimePickerWrapper

dateTimeFrom_win32 = DateTimePickerWrapper(dateTimeFrom_wrapper.handle)
dateTimeFrom_win32.set_time(year=2017, month=5, day=23) # if it's date only control (or see full params list)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Date picker problem: How to solve it? - WordPress.org
I did some research about the “datepicker” bug and I finally solve the problem! The formatting of the date/time display was no longer...
Read more >
JQuery datepicker not working - Stack Overflow
I was stuck on an issue where datepicker() appeared to be doing nothing. It turned out that the issue was that the input...
Read more >
Date Picker problems - Material Design for Bootstrap
Problem 1: I have two in line datepickers. when I have the first datepicker ('From' datepicker) opened and I try to click the...
Read more >
Issues · Hacker0x01/react-datepicker - GitHub
A simple and reusable datepicker component for React - Issues · Hacker0x01/react-datepicker.
Read more >
Problem with DatePicker control - Power Platform Community
Problem with DatePicker control ... I applied the DatePicker control in my form and now chose a date like 12.05.2018. When I check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found