Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 14:45
    codecov[bot] commented #1210
  • 14:21
    codecov[bot] commented #1210
  • 14:19
    codecov[bot] commented #1210
  • 14:14
    codecov[bot] commented #1210
  • 14:11
    codecov[bot] commented #1210
  • 11:14
    codecov[bot] commented #1210
  • 11:14
    codecov[bot] commented #1210
  • 11:14
    eltimen synchronize #1210
  • 01:06
    nnz6497 edited #1224
  • 01:01
    nnz6497 opened #1224
  • Jun 26 17:02
    hkfsc edited #1223
  • Jun 26 17:01
    hkfsc edited #1223
  • Jun 26 16:51
    hkfsc opened #1223
  • Jun 25 12:16
    codecov[bot] commented #1210
  • Jun 25 11:53
    codecov[bot] commented #1210
  • Jun 25 11:50
    codecov[bot] commented #1210
  • Jun 25 11:43
    codecov[bot] commented #1210
  • Jun 25 11:42
    codecov[bot] commented #1210
  • Jun 25 11:39
    codecov[bot] commented #1210
  • Jun 25 08:50
    codecov[bot] commented #1210
Sripad Sahu
@sripad96_gitlab
okay
and is there any way i can get a list of all the options(items) available in the particular window?
Vasily Ryabov
@vasily-v-ryabov
There is parameter .click_input(coords=(x, y), absolute=False)
Sripad Sahu
@sripad96_gitlab
My aim is to create a JSON or config file with all the parameters as in the settings so that the automation becomees easy and versatile.
There is parameter .click_input(coords=(x, y), absolute=False) : i have tried this function only for the tab items
Vasily Ryabov
@vasily-v-ryabov
For the window specification there is method .print_control_identifiers(). It prints the whole hierarchy or by depth parameter.
If you need to walk the hierarchy programmatically, use .children() and .descendants().
Sripad Sahu
@sripad96_gitlab
print_control_identifiers() function only gives the control name and the class, i also want to know the state. for example : if there are few checkboxes and drip downs and radio buttons , i want to know which of them are selected and what are the options selected. My main motive is to automate it instead of manually writing the json or config file for the entire setting of the program
Vasily Ryabov
@vasily-v-ryabov
OK, then .children() is your choice. States can be retrieved by different methods of every control. It’s good idea to provide unified methods like .state() and/or .capabilities() returning dictionaries of properties. You’re always free to submit a pull request or issue about this. I can’t promise to assign high priority for now though.
Sripad Sahu
@sripad96_gitlab
i have a list of all the descendants in a list, now i want to segregate them according to their type, i.e: store them in different lists /tuple. But i am unable to access them since they are UIAwrapper object. Any idea how to achieve this?
Sripad Sahu
@sripad96_gitlab
dont bother got it
using descendants().get_element_info.name
what is the difference between children and descendants
???
Vasily Ryabov
@vasily-v-ryabov
children() are immediate children (1 level below). .descendants() is a whole sub tree as a plain list.
Sripad Sahu
@sripad96_gitlab
okay... thnak
Sripad Sahu
@sripad96_gitlab
top_window() function doesn't always return the top window ... so is there any other way to get that ... maybe a workaround
Vasily Ryabov
@vasily-v-ryabov
top_window() is not recommended since it creates window specification by handle of first top level window at the moment of creation.
Good way is app.window(active_only=True), but it assumes the window should be in focus.
Also for “uia” backend top window can be child of main form. In this case it should look like app.MainFormTitle.child_window(control_type=“window”, active_only=True).
Sripad Sahu
@sripad96_gitlab
that means i need to create a workaround to replace top_window()
Also for “uia” backend top window can be child of main form. In this case it should look like app.MainFormTitle.child_window(control_type=“window”, active_only=True).
wouldnt app.MainFormTitle.child_window() will return all the handles of the windows active in the screen??
I am currently facing problem in getting the top active window. My problem statement is to deal with the following situation: if i click a button and nothing happens i.e no window or dialog box is generated, then who to continue the flow so that it doesnt breaks the entire script.
Vasily Ryabov
@vasily-v-ryabov
You can check that some window didn’t open by app.MainWindowTitle.SubwindowTitle.wait_not(“exists”, timeout=10) during 10 seconds. Or use method .exists(timeout=10) which returns True/False instead of raising exception.
.child_window() creates window specification (to find automatically or to apply .wait()/.wait_not()), it doesn’t list all children. Method .children() or .descendants() is what you need to list child controls.
You can find section “Waiting for long operations” in the docs after reading the Getting Started Guide.
amursa
@amursa

Здравствуйте, в UIA прошелся инспектором по меню. отрыть 2го уровня меню удалось, но никак не может нажать на кнопку. Использовал, click, invoke, select , - падает просто указывая на строку вызова. app.UntitledNotepad.menu_select("File -> Exit") - работает, в другом приложении не работает - main_window.MenuSelect('Setup->Securities & Parties->Securities').click() - не работает. Cмог открыть меню, не не позволяет нажать на поледий отрытый елемент:
main_window.window(control_type="MenuBar", title="CrdMenuStrip").child_window(control_type="MenuItem", title="Setup").select()
main_window.window(control_type="MenuBar", title="CrdMenuStrip").child_window(control_type="MenuItem", title="Setup").\
child_window(control_type="MenuItem", title="Securities & Parties").select()
main_window.window(control_type="MenuBar", title="CrdMenuStrip").child_window(control_type="MenuItem", title="Setup"). \
child_window(control_type="MenuItem", title="Securities & Parties").child_window(control_type="MenuItem", title="Securities").click()

вегда вылетает ошибка:
def init(self, errors='strict'):
IncrementalDecoder.init(self, errors)

    # undecoded input that is kept between calls to decode()
    self.buffer = b""
amursa
@amursa
All i did id is to change main_window.MenuSelect('Setup->Securities & Parties->Securities').click() to this main_window.menu_select('Setup->Securities & Parties->Securities') and it worked.
Roman Isakov
@Xcqcr_gitlab

Здравствуйте, Василий.

Кажется, что print_control_identifiers() обходит далеко не все объекты, если backend='uia'

Например, Inspect.exe в режиме UI Automation находит гораздо больше "детей", когда print_control_identifiers() от основного окна находит только "родителя".

python:
[IN]
import pywinauto

a = pywinauto.application.Application(backend='uia')
a.connect(process=3936)
p = a.window()
p.print_control_identifiers()

[OUT]
Control Identifiers:

Dialog - '1С:Предприятие - ERP' (L551, T144, R1460, B764)
['1С:Предприятие - ERPDialog', 'Dialog', '1С:Предприятие - ERP']
child_window(title="1С:Предприятие - ERP", control_type="Window")

Хотя Inspect.exe от MS SDK показывает, что элементов целая уйма. Кнопок, тулбаров и пр
Roman Isakov
@Xcqcr_gitlab

Да, могу сказать, что print_control_identifiers() возвращает аналогичное количество значений, что и Inspect, если backend=win32

Но использовать backend=win32 вообще не мой вариант, ибо там нужно вручную каждый элемент искать (имена кривые, никак не ассоциировать)

1
Roman Isakov
@Xcqcr_gitlab
А, да, еще есть маленькое добавление - py_inspect, который Вы написали, отлично строит дерево. У меня есть подозрение, что print_control_identifiers(), которая относится к Application не эквивалентна перебору def __get_next(self, element_info, parent) в py_inspect.
Vasily Ryabov
@vasily-v-ryabov
Добрый день. Возможно, это известная проблема с неправильным пробросов флага visible_only=True, который глотает hidden элемент вместе с поддеревом, хотя в поддереве есть visible контролы. Вот ссылка на issue: pywinauto/pywinauto#596
К сожалению, в dump_tree / print_control_identifiers это не обойдёшь без фикса. А вот в .child_window() можно явно прописать visible_only=False. Несколько неудобно, но пока так.
Vasily Ryabov
@vasily-v-ryabov
Попробуем посмотреть и впихнуть в надвигающийся апдейт релиз 0.6.6.
_fantasticDev_
@SnakeGeneral
hello everyone~
app = Application(backend='uia')
app.start(r'../hello.net.exe')
in this case, i want to get the coordinate of the window.
please help me~~~
Vasily Ryabov
@vasily-v-ryabov
app.window(title=“Window Title”).rectangle() ?
_fantasticDev_
@SnakeGeneral
thank you sir
but i can't know the title
do you know Battle.net.exe?
@vasily-v-ryabov
shall i send you the source URL?
_fantasticDev_
@SnakeGeneral
@vasily-v-ryabov
hello sir

app = Application(backend='uia')
app.start(r'../Battle.net.exe')

time.sleep(1)
rect = app.window(title='Blizzard Battle.net Login').rectangle()