Java Native Interface (JNI) - java

I'm using Java and Selenium on a VPS. I need to execute a specific set of Selenium code under a different windows user account. I know Java does not support this functionality. I came across Java Native Interface which supposedly supports this functionality - can anyone show me how I'd use this to run code under another user account?
Note: I'm aware of Selenium Grid however there's certain functionality Selenium Grid does not support therefore I want to execute standard Selenium code under a different windows user account (locally).
Thanks

Related

Java Programming: Something like Watir-Webdriver running in background

I have written a program in Ruby that checks a web page every so often, and performs some actions if data is found. I have written this using Watir-Webdriver.
I also want this program to run as a "daemon". The problem I had with Watir-Webdriver was that I could not run it without a browser popping up everytime.
I actually need to write this in Java? Which is best Java package thats similar in functionality to Watir-Webdriver?
Is there any way to implement this in Java - to check a webpage and do specific actions - all in the background?
Also, I would like this to be cross-platform.
Thank you in advance to help
You are looking for Selenium WebDriver. It can be written in Java and many other languages.
Yes. Webdriver can run different types of browsers. You are looking for what we call a headless driver. The most popular headless drivers are HtmlUnitDriver or GhostDriver. I personally prefer GhostDriver, as it runs a more modern version of Javascript.
All Java code can be run on different platforms, so that shouldn't be a problem.

Chrome Browser and Java Message Passing

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?

Automation testing in Java or Android possible

I am working on writing automation to test hardware (Wi-fi, Ethernet, Bluetooth, GPS and keyboard). Nothing is automated its all manual testing at the moment. the product will load a live USB OS and from there it will run a application. I need to write Java code which will launch the application, selects the proper options and spits out the pass or fail results. This all things needs to be developed in Java if possible or Android, I am not sure if I am allowed to use any existing third party tool.
If this is possible to write on Java or Android are there any tutorials or if there any third party suggestions I appreciate information in general about this if this is at all possible and where to look for this information.
What you are looking for is Cucumber framework. It is a framework which automates the testing for you. You write some calabash/ruby scripts and open up a port on your network and Cucumber takes care from there on.
Check this link: https://github.com/cucumber/cucumber/wiki
Also see: http://cukes.info/
Also search for the cucumber_book by Matt Wynee if you can get one. It is a real good reference.

How to automate PHP-Flash web application using selenium java

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

How do we test our Java UI?

We're looking at record and playback type test tools to automate some of our UI functional testing.
We've looked at most of the usual suspects from Silke to QTP and none of them work.
They all fall over when a right click is required to select something off a right click menu, or when you have to choose a value in a drop down list in a grid.
Does anyone know any tools that can handle this type of UI?
We have made good experiences with Squish. You can identify UI elements by IDs or record mouse actions.
Are you talking about a stand-alone Java application, or is it web-based, with Java on the server, but HTML delivered to the client?
Assuming it's a stand-alone Java application, SilkTest and QTP ought to play nicely with Java. (Are you using the appropriate Java add-in/plugin for Java support? QTP has a separate add-in for Java support.) Another tool to consider would be IBM Rational Functional Tester. It's built in Java and works well with Java apps. I've used all 3 tools, though never SilkTest on a Java app. In my experience, both QTP and RFT performed well with Java apps.
That having been said, on every test automation project, there are going to be UI controls that do not work great out of the box with the selected automation tool. (3rd party controls are usually the culprit). In these cases, you will need to manually code a work-around. In the example of right-clicks not working as expected, I have often needed to forego clicking to select an item from a right-click menu in favor of using keystrokes to select the desired item. What this really points to is that you have to let go of the notion of record/playback being an effective means of automation.
Additionally, it might be instructive for you to post the actual code that was recorded, and at which line it fails to select the item in question. The actual script code could give me some clues as to what is actually going on.
Sahi is good option for recording and playback like testing stuff.
Here is a sample tutorial.

Categories