How can I access browser extension's popup using selenium? - 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.

Related

How to Automate Chromium Browser in Code UI Test

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

Automatized tool to test site via browser?

does anybody knows a tool when I can set a scenario (click here, fill this form, submit) just like a human did it? Preferably with Firefox
you can test site by using selenium. Its a automated testing tool.Selenium IDE is a Firefox plugin.So you can use that

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

Automated Web Testing Tools in Java

I want to test a Ajax based web application. I want to write the test scripts in Java and simulate the web browser.
Simulation of a web browser is very important since Iam using very advanced Ajax library like jQuery in the web Application.
Any ideas on how I should proceed?
I think you might want to give Selenium a look.
Kindness,
Dan
Doing "simulation" of a browser will probably not work that well if your application relies on Javascript a lot : there are some crawlers that you can use to test your application, but they don't like JS that much.
The best solution in your case might be to use a real browser to do your testing.
The Selenium tool-suite is quite nice for that : it allows your testing programm to pilot a browser (a real one : firefox, internet explorer, ...) ; which mean having you JS code executed exactly the same way that it would be with a "real" user.
For instance, you can have your testing programm tell a browser to open a page, click on a link, check some content in the page, ... And if there was some JS event plugged onto the link, it will have been executed : there will have been a real "click" on the link.
Using a tool like selenium has some drawbacks, though ; some of them are :
you need a machine with a graphic environnement, to launch the browsers (command line is not enough)
tests with selenium take time : browsing and using the application means loading all the CSS/JS/Images/ads/whatever, for each page ; like in a real browser -- because you are using a real browser
But these tests are quite nice, and usefull to test the application as a whole -- ie, more "functionnal tests" than "unit-test".