Embedding Chrome browser in python QT GUI? - python

I have a python GUI that opens a Chrome window using Seleium. Is there any way in the PyQT GUI to embed the Chrome browser's window so there are not 2 separate windows and its just the GUI? Guessing not possible but worth it to ask.

I have been looking to do exactly the same. I don't have a complete answer but hopefully some of what I found will be of use to others who are trying to do this as well.
It IS possible to embed the window of an outside application into a Python QT application. While I could quote various reference pages I have found that the following question gives most of the information and a good starting point to find more:
QT 5.5 embed external application into QWidget
Now, that requires knowing the Window ID but that isn't too hard to find. You can do that in Windows at least as described here:
http://timgolden.me.uk/python/win32_how_do_i/find-the-window-for-my-subprocess.html
As I said, this isn't a complete answer but should put anyone else following this trail several steps closer to the complete answer. Good luck everyone and if you find the complete answer please share it.

Related

Python GUI Tutorials

I'm looking for good longform tutorials on creating GUIs with Python. I've found one previous answers, but it's quite old (10 years) and closed. What would you recommend? Any good example repos?
I want to have a dynamic user interface that allows the user to tab between different screens, enter data, and see output plots update (preferably live, but a button click to update would be acceptable as well). Does this narrow my available options to a particular GUI tool?
Previous Question: Python 3.x GUI Tutorials
you have this tuturial in first link in English with PYQT and guizero in the second link(in portuguese)
https://www.youtube.com/watch?v=MOItX2aKTGc
https://www.youtube.com/channel/UCiTnSna5qYf9tC0mBScw2Rg

Application for windows and mac using python

I'm in a dilemma. I've got a python code that works for each of the yellow squares shown below but I want to make an application that looks like below and uses the information from the first text box and the second drag and drop box. Then depending on what the user clicked on, the code for that would run. I'm not sure how to approach this. Any help would be greatly appreciated!
You can use Python GUI libraries like:
Tkinter
PyQT
WxPython
Kivy
Pyglet
(This list is not exhaustive.)
Each has their own advantages and disadvantages. Choose the one that fits your project the best.
My personal recommendation for your particular project would be Kivy.

Terminal equivalent for gui popup windows in python

I am going to write simple "to do list" app in python. One of the features will be possibility to configure notifications/reminders for tasks. If user will be using GUI I am going to use some popup windows, but what if he runs the app in the terminal, without any GUI? What would be the best equivalent for that? Is there a possibility to somehow notify the user?
I will be thankful for any guidance or at least direction, I tried searching for all variants of "terminal/console/text" + "notifications/popups" but I did not find anything interesting...

Automating Flash Program with Python using Pywinauto

I am trying to send a couple basic text commands to a flash program running in Firefox on Windows 7, but I am unable to get pywinauto working for me.
Right now, I have just been able to accomplish the very basic task of connecting to Firefox plugin-container by directing it to the path using the following code:
from pywinauto import application
app = application.Application()
app.connect_(path = r"c:\Program Files (x86)\Mozilla Firefox\plugin-container.exe")
The next step seems to be something to the effect of:
app.plugin-container.Edit.TypeKeys('Text')
However, I can't reference the plugin-container window using '.plugin-container', or any combination of those words. I have tried adding a title variable to the connect_() function and I have tried everything I can think of to find out how to type the command.
The example I am basing this off of is the notepad sample:
from pywinauto import application
app.start_(ur"notepad.exe")
app.Notepad.Edit.TypeKeys(u"{END}{ENTER}SendText d\xf6\xe9s "
u"s\xfcpp\xf4rt \xe0cce\xf1ted characters!!!", with_spaces = True)
It doesn't matter to me if I use pywinauto or Firefox. If it is any easier to do this using a different module or Internet Explorer, I'm on board for whatever accomplishes the task. I am using Python version 2.7.2 and would prefer it over any version changes.
Any help at all is appreciated. I am pretty lost in all this.
As the author of pywinauto - I think you are going to have a hard time. pywinauto only really helps with standard windows controls, and I don't think that flash controls are implemented as standard windows controls (Buttons, Edit boxes, etc).
OFf the top of my head - I would think Sikuli may be a better starting point (http://sikuli.org/).
Another option may be 'http://code.google.com/p/flash-selenium/' - I just googled for "automating flash input" - and it turned up in one of the first articles I clicked.
Thanks for trying pywinauto - I just don't think it is best suited for Flash automation.

How to make PowerBuilder UI testing application?

I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it).
Any ideas how to reach this elements and make them testable?
I'm experimenting with code for a tool for automating PowerBuilder-based GUIs as well. From what I can see, your best bet would be to use the PowerBuilder Native Interface (PBNI), and call PowerScript code from within your NVO.
If you like, feel free to send me an email (see my profile for my email address), I'd be interested in exchanging ideas about how to do this.
I didn't use PowerBuilder for a while but I guess that the problem that you are trying to solve is similar to the one I am trying to address for people making projects with SCADA systems like Wonderware Intouch.
The problem with such an application is that there is no API to get or set the value of a control. So a pywinauto approach can't work.
I've made a small tool to simulate the user events and to get the results from a screencapture. I am usig PIL and pytesser ORM for the analysis of the screen captures. It is not the easiest way but it works OK.
The tool is open-source and free of charge and can be downloaded from my website (Sorry in french). You just need an account but it's free as well. Just ask.
If you can read french, here is one article about testing Intouch-based applications
Sorry for the self promotion, but I was facing a similar problem with no solution so I've written my own. Anyway, that's free and open-source...
I've seen in AutomatedQa support that they a recipe recommending using msaa and setting some properties on the controls. I do not know if it works.
If you are testing DataWindows (the class is pbdwxxx, e.g. pbdw110) you will have to use a combination of clicking at specific coordinates and sending Tab keys to get to the control you want. Of course you can also send up and down arrow keys to move among rows. The easiest thing to do is to start with a normal control like an SLE and tab into the DataWindow. The problem is that the DataWindow is essentially just an image. There is no control for a given field until you move the focus there by clicking or tabbing. I've also found that the DataWindow's iAccessible interface is a bit strange. If you ask the DataWindow for the object with focus, you don't get the right answer. If you enumerate through all of the children you can find the one that has focus. If you can modify the source I also advise that you set AccessibleName for your DataWindow controls, otherwise you probably won't be able to identify the controls except by position (by DataWindow controls I mean the ones inside the DataWindow, not the DataWindow itself). If it's an MDI application, you may also find it useful to locate the MicroHelp window (class fnhelpxxx, e.g. fnhelp110, find from the main application window) to help determine your current context.
Edited to add:
Sikuli looks very promising for testing PowerBuilder. It works by recognizing objects on the screen from a saved fragment of screenshot. That is, you take a screenshot of the part of the screen you want it to find.

Categories