Automate launching and performing GUI operations in Java Web Start application - automation

I want to automate GUI testing that involves following steps.
Open a URL in my web browser (Internet Explorer). The page at this URL will contain a link.
Click the link on the page. This will download a JNLP and launch the Java Web Start application automatically.
The application will have some text fields that need to be filled in and some buttons that need to be pressed.
How can I automate this?
Platform: Windows
Edit: I'm looking at Sikuli as a possible method of automating this, but I don't know if it will be able to switch between applications from the web browser (in step 1) to the Java application (in step 3). Are there any other tools available (preferably open source) that I should be looking at?

Sikuli will be able to switch between the two applications, for sure. It's quite good at that sort of thing, since it's agnostic about the underlying GUI technology.
In my opinion, Sikuli sounds like the fastest and easiest way to get your test scenario automated, because otherwise you may need to deal with two frameworks (one for automating the web browser and another for your Java application).

Related

Does Microsoft UI Automation Framework work with Chrome, Python and Java Apps?

I am working on an automation project, in which I need to capture the activities [ application launched, data entered, input type etc.] user performs on a desktop. I came across Microsoft UI Automation framework which so far works well for native windows based applications like MS Office, .NET apps etc. However I did not find any useful information / samples of capturing the information from different web browsers [Chrome is a must], Python apps, Java Apps etc. Can someone please confirm whether MS UI Automation Framework supports such apps. Any working example to extract user activities from these apps would be highly appreciated. Thanks.
Chrome only supports UI Automation for toolbars, tabs, menu, buttons around the web page. Everything that's rendered as a web page is not seen by UIA.
For the web page content, the easiest way is to use Selenium (driven by the ChromeDriver), which is kind of a de facto standard for browsers, and has nothing to do with UIA.
To test if an app supports UIA, and how far it does, it's very easy, just run UIA's Inspect tool and check the UI tree over that application.
Some additions to Simon's answer...
Chrome page content can be seen by UIA if you run chrome --force-renderer-accessibility. Only for existing Chrome process it won't work. Though user can create a new tab chrome://accessibility manually and enable UIA for all or some chosen pages. This method also works for AT-SPI accessibility technology on Linux. Of course, Selenium WebDriver is an industry standard here. But another way exists. Both Mozilla and IE support UIA by default.
Inspect.exe can be simply downloaded from this GitHub repo.
Regarding Java apps it depends on the app type. Your chances is about 50/50.
WxPython or PyQt5 are good for UIA. TkInter or Kivy apps are not.
P.S. There is an example how to drag a file from explorer.exe and drop to Google Drive in Chrome using Python library pywinauto.
I'm a bit late to the party..
But Chromes accessibility features are only activated once something tries to access it's accessibility.
If you call AccessibleObjectFromWindow ([DllImport("oleacc.dll")]) with the window handle an existing chrome window will have its accessibility activated (and you'll see the actual web page content in UIA!).
If the chrome window is opened after your app is running - Chrome pings open processes for any open accessibility apps... for that you use AccessibleObjectFromEvent and the event you're responding to comes from the windows pipeline: EVENT_SYSTEM_ALERT = 0x0002 .
The bottom line is - you have to tell chrome that there's something installed that wants to access it's web page content.
Oh! and your application has to be signed!! Unsigned apps won't be able to access web content - I think that's the same in firefox too.
I hope this helps someone in the future.
See:
https://www.chromium.org/developers/design-documents/accessibility

Automation testing between desktop and web application?

I am working on a retail based project. We have two UI. One is web portal where different types of vouchers can be created. These vouchers can be issued and redeemed from desktop application. The issued and redeemed voucher update details will be uploaded to web portal. I am using sikuli to automate desktop application. Can i do GUI testing between desktop and web using sikuli?
Thanks in advance.
As far as my investigation goes, testing end-to-end scenarios that involve both, we and desktop applications, Sikuli is the only option.
When making the decision there few limitation to keep in mind though:
Sikuli tests will only work on the same resolution screen as the one the tests were been created on.
You will need to have a physical computer switched on with a screen attached to it to work.
As it was mentioned in other post here, long scenarios with Sikuli can become brittle. So if you have an option to split your end-to-end scenarios into multiple standalone pieces, while using Selenium for the web part and Sikuli for the desktop app, that probably will be the best solution. Perhaps do some data preparation in one app and save data in a file, then run the other part and assert everything has worked as expected based on that text file.
Base of sikuli is to search the UI controls on screen, based on screenshot.
Also it provides Sikuli API for Java with which you can do a programming around the AUT.
To answer your question,
As long as it is GUI and it's expected screenshot can be taken, then Yes, you can use Sikuli to test Desktop UI & UI for the site opened in Browser.
But testing Web UI with sikuli is quite hectic process as you may need to take screenshots of every testable controls. It will be more cumbersome if site is heavily loaded with images and input controls.
We have selenium IDE/selenium webdriver to perform such testing.
You can use Sikuli on the desktop side where autoIT may become heavy job and the UI is quite static.

Automatically click website buttons like selenium

I have a project that requires automating a process on a website (login, click buttons, make decisions, etc.).
Ordinarily I would use something like curl to do the automation and not worry about the UI at all, however this site uses ASPX and redirects and is just a mess, so I need to write something like a selenium test to do it.
A selenium seems like a bit of a hack though, so I was wondering if there is any alternative or tool that may be better than selenium at walking the dom and "clicking" elements?
Guidance or examples appreciated.
A non programtic way would be to use Selenium IDE. Basically you record the events via a Firefox extension and can replay easily. I understand this is a non automating way as it requires a manual playback.
However one element that I really like is that I can use this extension to record my events and then generate scripts to automate playback via Selenium Remote Control drivers.
Selenium IDE is an integrated development environment for Selenium
scripts. It is implemented as a Firefox extension, and allows you to
record, edit, and debug tests. Selenium IDE includes the entire
Selenium Core, allowing you to easily and quickly record and play back
tests in the actual environment that they will run in.
Yes I know you think selenium is a hack but it is rather pretty good!

running autoit/autohotkey scripts from server? or other automation alternatives?

I have some scripts (AutoIt) browsing YouTube for list of trending videos etc. It involves no mouse clicks (just keystrokes). The script takes a long time to finish and I can't use my PC during this time (it needs the window activated to work on it).
Is there anything I can do about this? Can these scripts run from a server or some stuff like that?
I've run into a similar problem: got to run automation with AutoIt on a Windows Server and the whole thing had got to be headless. Using Remote Desktop simply didin't work because then I'd had to keep a client opened and maximized all the time.
Short solution: install a VNC server in the Windows Server, open a client from another computer, log in and close the client. As the AutoIt script was being started by a Jenkins job, before closing the client the Jenkins applet had to be started via web interface.
By the way, I've had this idea from this post: How to run remote headless GUI automation.
As Johannes said, AutoIt probably wouldn't be suitable (and likewise AutoHotkey), but you could check out the many GUI and web testing frameworks that exist for other languages. With some of those, you can run a "headless" browser (a program that navigates the web just like a browser, but has no visible window); or you can run a standard browser on a virtual display like a Xvfb X11 server. This would be easiest if the server (or wherever it's going to run) is running a Unix-like OS, but it may be possible with Windows too.
Selenium Webdriver seems to be a very popular choice for scripting and testing actual browsers. It's natively Java but has bindings for languages like Ruby. It can also hook into something called HtmlUnit, which is also Java; that's one of the more popular headless browsers. Another (a relative newcomer) is phantom.js, which is in Javascript but (again) has bindings for other languages.
As far as I know this will not work unless the user account is logged on. You could try to see if you could convert it to an exe and run this as a service, but even then I don't think this will work. Let me know if you found out!
You can either:
Hide your window (SetWindowState #SW_HIDE) or something like that...
and use ControlClicks (if the they are original controls!)
or
Hide your window and use SendControl
or
use SendKeepActive
or
use OLEObjects like ie.au3 for automation.
Good Luck

Selenium tests and continuous integration (Running browser in background)

We have Xserver-less CentOS system for continuous integration. So no UI.
I want to run selenium test cases on it. I am using new Alpha version of Selenium2 which has WebDriver integration. It starts and ends browser by its own. Now, How do I start that in background? Something similar is possible with Internet Explorer?
I am able to run correctly on local machine. But it opens Firefox UI.
Are you able to run a virtual frame buffer? That way, all the GUI programs can believe there's graphics happening, even if there's no actual screen. You may wish to search for the term "headless". One example.
Another possibility may be to use Celerity - a ruby-based "headless browser". It uses the Watir interface (originally a competitor to selenium), which I understand to be merging with webdriver.