How to Automate Chromium Browser in Code UI Test - automation

Currently i am automating the Desktop Application using CodedUI tests.
I am facing some challenges, there are inside Desktop application we having Chromium browser concept. Unable to record the chromium browser element and getting the element. If normal web page in the Desktop application, i can able to record and get all the wen elements.
So can you anyone help me how to get all the element in the chromium browser using Coded Ui test

I overlooked the question date. But still I posted it as answer, Because I think, still it would be helpful for others to get rid of the problem mentioned in question.
I too had the same issue. After lot of R&D, I found it's very hard (perhaps impossible) to automate CEF using Coded UI.
However, it can be automated using selenium. Moreover, selenium is easy to integrate within coded UI test, if you wish to not leave coded UI.
Here's some links which you can refer how to automate CEF using selenium:
Chromium Embeded Frameowrk using chromedriver.
GitHub Example
Example Framework

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

How can I access browser extension's popup using selenium?

I want to write an acceptance test for my browser extension. I've tried to initiate an extension via selenium but I can't seem to access a content of popup. Can someone suggest how can I do it with selenium or any other way to write UI/acceptance tests for browser extensions? Thanks.
How can I access browser extension's popup using selenium?
It's not possible. Selenium supports interaction with web view only.
What you can do with Selenium and extension for sure is automatic installation: https://stackoverflow.com/a/16512012/2517622
You may try to use desktop automation tools (e.g. White on Windows platform) for clicking on extension popup but it's not that easy and it's not platform independent as Selenium.
Here is the workaround we came up. Unless someone posts here the "right" solution I will consider this as the best approach.
So eventually, our extension is an iframe which just loads a page content from our website + does some other neat stuff. We simply open that url in a new tab and do regular selenium tests.
Side not: we have considered to write a little javascript wrapper to be able to access ext via main window through javascript. E.g. there is some js in ext that listens to main window's events and perform certain actions. Tho, it is too much efforts and doesn't really sound like a proper acceptance test so we discarded this approach.

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!

Automated browsing of complicated web pages

I have a project that will involve heavy automation of complicated web pages.
I realize there are Mechanize and Beautiful Soup, but don't these break when dealing with large amounts of DOM scripting and other weird stuff you find on complicated web pages?
I think I want essentially a barebones running instance of WebKit that allows me to either do "GUI scripting" or access the DOM. Ideas?
Try Sahi with PhantomJS. Sahi is a browser automation tool, and PhantomJS is a headless Webkit browser. You can find set-up instructions here: http://sahi.co.in/w/sahi-headless-execution-with-phantomjs
Disclaimer: We created the Sahi product.
What platform are you working on? And what language do you intend to use?
Adobe Air let's you embed a webkit inside an Air application and interact with the page JavaScript (there is two-way communication between the page JS and the AIR runtime).
Otherwise, if you are not bound to webkit you could take Mozilla Chromeless for a spin.
My apologies if none of this does what you need to do, I can't quite figure what exactly you are trying to do (page scraping? submitting forms?).
For testing/scraping i would try:
Selenium
EnvJS
Windmill
Watir
Sahi
WebTest