I will be responsible for test automation for angular application. I know that we have a protractor tool but i prefer webdriver with java(feel better with this than javascript and protractor). May i use java with webdriver or i must do it using protractor because selenium will not handle it?
Of course, you can still use the regular Java selenium bindings to test AngularJS applications. It's just that Protractor is simply more suitable/convenient to use for specifically AngularJS applications because of the several unique things it provides:
it works in sync with Angular - it always knows when Angular is "ready" to be interacted with
it provides Angular specific locators like by.model, by.binding, by.repeater etc
it allows you to easily mock AngularJS modules on the fly
it is developed and supported by Google developers (and of course the github community) - meaning it is in sort of a sync with Angular development cycle
it has a very nice and documented API
and many more
It's also important to understand that Protractor is actually a wrapper around the WebDriverJS - JavaScript selenium bindings. And, as a side note, Protractor can also be used to test non-angular apps (just turn the sync off).
There is also ngWebDriver package that might actually be your solution:
We have taken JavaScript from Angular's Protractor project. While
ngWebDriver perfectly compliments the Java version of WebDriver, it
has to pass JavaScript up to the browser to inteoprate with Angular,
and the Protractor project has done the hard work (including testing)
to make that solid, and ngWebDriver benefits from that work.
Also see:
Use protractor with Java
how to implement protractor JavaScript API in Java to use in existing Selenium Java Frameworks
Related
I want to know how to automate SAP Fiori (Browser) using Selenium in Java?
Did I need to install some external tools or need to enable some SAP configuration in order to read the element inside Fiori interface?
I already tried to read Fiori element but the selenium keep on telling that the element cannot be found.
thanks for your kind respond guys i try with Xpath that include (contains) it seem working but with normal get by.id/class/tag it seem some value cannot be read by Selenium. just one thing i did not sure did HTTP / HTTPS affected the Selenium detection?
This question is pretty generic.
It should be possible, to use Selenium for testing UI5 apps.
Here it says that you need to install additional Selenium web drivers.
You might also want to check out OPA5, as described under Testing
and under Integration Testing with One Page Acceptance Tests (OPA5).
This blog compares Selenium and OPA5.
This thread Automated UI tests for SAP UI5 might also be helpful.
I am looking for a web browser that would run in background in my java application. It would fetch all resources related to a url and create the DOM, run starting js scripts and etc. It would do everything a browser does but it need not have a UI but an API to control the rendered page, execute js scripts and etc on it is needed.
It should support latest HTML, CSS and JS implementations.
Is there something like that out there?
It is easily possible using products like phantom.js. The reason that it can be done easily in phantom.js and not in java is - phantom.js uses V8 scripting engine, the same engine that empowers Google Chrome browser. So effectively Phantom JS is like an invisible google chrome browser. There's no similar support available in Java.
Java does support custom scripting engine Scripting Engine in Java. But that is just one part of the story, you need to be able to load HTML/DOM, interpret CSS etc.
So , my suggestion will be to call phantom.js from your java app. You can explore using JNI to manipulate phantom.js behavior.
I have developed a Chrome extension and it captures some data in a webpage.
My ultimate goal is to pass this final result to my Java Application.
I have following few options in my mind, but I was not able to find any resources for them yet.
Access the localStorage externally.
Run Chrome browser through the Java app, So I guess we have the control of its data.
If no API found, write the result to a file and access it from the
Java App.
Is there any API to achieve any of the first 2 options? Or any other interface other than the file system?
I checked with berkelium and The Chromium Embedded Framework. But they are just chrome wrappers, and we cannot run a chrome instance from it.
Edit
For the 2nd option I tried with Selenium Webdriver, but I think it hasn't any method to access the localStorage.
It sounds like you are looking for Native Messaging, which allows communication between a Chrome Extension and a native application (e.g. a Java Desktop Application).
There are plenty of question here on SO regarding the implementation of Native Messaging and there is, also, the "official" example.
I suggest the above solution, but if your application will heavily interact with the extension (and you feel like reverse engineering) there is the open-source **[NetBeans Connector Chrome Extension][3]**, which uses a different approach (Sockets or WebSockets - I am not sure).
Take a look at **[this answer][4]** for info on how to get at the sources.
Is there a limitation preventing you from exposing a REST API with your java application?
I need to automate a web application which is in PHP with flash. Is it possible to automate the application using selenium java with FlexUISelenium or FlexMonkium.
Thanks in advance.
If it's pure Flash without Flex then you should put some external like these methods to your Flash application and call them from your test code in order to verify functionality. If it's Flex then FlexUISelenium and FlexMonkium will help you - but again you should compile these libraries into your Flex app - they contains required methods to be called from Selenium.
In the case you are not allowed to modify your Flash application I would recommend to take a look to image-based tools like Sikuli
Does anyone know of any Java library for programmatic web browsing?
Prowser doesn't cut it because there's no "push the button" method and Watij is limited to Internet Explorer Windows only.
htmlunit?
http://htmlunit.sourceforge.net/
The above link says:
... HtmlUnit is not a generic unit testing
framework. It is specifically a way to
simulate a browser for testing
purposes...
You may be able to find some of what you want in Selenium and especially when using Selenium Server like in this IBM article