dubravcik / pbixrefresher-python

Refresh Power BI reports programmatically for free
MIT License
122 stars 54 forks source link

Element not found #32

Open wgalantino opened 4 years ago

wgalantino commented 4 years ago

Hey I found this and really hoping to make it work - unsure of what would cause the below but observations: It asks If you want to save before publishing - which would imply that the save step is not working?

I saw some other similar issues posted - but wasn't able to find a clear solution -hopefully this is still active! Thanks for any help.

Starting Power BI Waiting 15 sec Identifying Power BI window Refreshing Waiting for refresh end (timeout in 100000 sec) Saving Publish Traceback (most recent call last): File "c:\python36\lib\site-packages\pywinauto\application.py", line 258, in __resolve_control criteria) File "c:\python36\lib\site-packages\pywinauto\timings.py", line 458, in wait_until_passes raise err pywinauto.timings.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Python36\Scripts\pbixrefresher.exe__main.py", line 9, in File "c:\python36\lib\site-packages\pbixrefresher\pbixrefresher.py", line 77, in main publish_dialog.child_window(title = WORKSPACE, found_index=0).click_input() File "c:\python36\lib\site-packages\pywinauto\application.py", line 379, in getattribute ctrls = self.resolve_control(self.criteria) File "c:\python36\lib\site-packages\pywinauto\application.py", line 261, in __resolve_control raise e.original_exception File "c:\python36\lib\site-packages\pywinauto\timings.py", line 436, in wait_until_passes func_val = func(*args, kwargs) File "c:\python36\lib\site-packages\pywinauto\application.py", line 222, in __get_ctrl ctrl = self.backend.generic_wrapper_class(findwindows.find_element(ctrl_criteria)) File "c:\python36\lib\site-packages\pywinauto\findwindows.py", line 87, in find_element raise ElementNotFoundError(kwargs) pywinauto.findwindows.ElementNotFoundError: {'auto_id': 'KoPublishToGroupDialog', 'top_level_only': False, 'parent': <uia_element_info.UIAElementInfo - 'Simple - Power BI Desktop', WindowsForms10.Window.8.app.0.1bb715_r6_ad1, 8914246>, 'backend': 'uia'}

wgalantino commented 4 years ago

Some more info on this - I think the problem is the type_keys method during saving is entering "Alt+1" - "%1" - when I try that manually in power bi I can hear a prompt noise but the file does not save - I hear the same noise during the script during the save portion - but again - it is not saving. When I try instead Ctrl+S manually in power bi this saves the document - I tried modifying the type_keys("%1", win) to type_keys("^s", win) but this does not seem to work either.

DarknessTech commented 4 years ago

Try this one, I had the same issue and edited the script. Now it's working fine. https://github.com/DarknessTech/pbixrefresher