【问题标题】:Pywinauto - How to select date from datepickerPywinauto - 如何从日期选择器中选择日期
【发布时间】:2018-11-28 23:41:21
【问题描述】:

我们需要帮助,我们正在使用 pywinauto 自动化桌面基础应用程序。 我们想从日期选择器(日历)中选择日期。

你能帮助我们吗?从日历中选择日期的任何解决方案或替代代码。

【问题讨论】:

  • 替代代码是什么?你有参考代码吗?你可以在问题中发布它吗?
  • 从日期控件中选择日期的替代代码,如 2018 年 4 月 27 日或今天日期。 MyDate = window.Calendar MyDate.Click(Today()) (日历是一个对象)

标签: python automation pywinauto


【解决方案1】:

this unit test怎么样?

ctrl.set_time(
    year=2025,
    month=9,
    day_of_week=5,
    day=19,
    hour=1,
    minute=2,
    second=3,
    milliseconds=781
)

或者特别是test_calendar.py

app.Common_Controls_Sample.Calendar.set_current_date(2016, 4, 3, 13)

【讨论】:

    【解决方案2】:

    做我的客人;)

    date_time_picker = get_child_by_properties(parent, {'class_name': 'SysDateTimePick32', 'control_id': ur control nr})
    
    date_time_picker.set_time(date_time.year, date_time.month, date_time.weekday(), date_time.day, date_time.hour, date_time.minute, date_time.second, date_time.microsecond)
    

    【讨论】:

    • 请提供一些上下文。
    猜你喜欢
    • 2020-02-05
    • 2021-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多