How to automate command prompt(putty) action via selenium - selenium

My application requires to enter commands on command prompt(Putty) and then I need to verify that from web browser.
I have used selenium for web functionalities but How can i achieve this with selenium?
which extensions /library files i would require?

Use Auto It (https://www.autoitscript.com/site/autoit/AutoIT) to automate the interaction with putty and run the script in Java using Execute command(or find the command specific to your programming language).

Related

Integrating shell scripts with selenium

I have a situation where we would like to run our Selenium test suite, but
at certain points in the process we would like to execute a shell command
on our machine.
Does Selenium have the capability of executing a shell command and to
receive a response and then to act on those results? Is this possible? If
so, how?
thanks in advance.
You tagged it TestNG meaning you write your Selenium tests in Java. The Selenium framework itself does not have a method to run shell scripts. But Java does, you can just execute commands in your tests and later use the output or input from/for Selenium actions.
Runtime.getRuntime().exec()
Read more:
In the Java documentation: https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec(java.lang.String[])
How to Run a Shell Command in Java: https://www.baeldung.com/run-shell-command-in-java
Using the output of the Shell command: java runtime.getruntime() getting output from executing a command line program
Selenium is just a library for interacting with web browsers. To strictly answer your question.. the answer is "No, it can not". However, you can easily integrate execution of shell scripts from your test code or framework. How you do that will depend on the language you are using.
Yes you can, but you have to use certain specific libraries along with it in addition to the language you choose eg. If you choose java, you either have to provide repo url via maven or gradle but if you just use python instead since it's highly interpreted, it can pull dynamic content that do pose limitation in Java Selenium, TestNG, PDFBox, POI lib etc. You can deploy a js library of your choice and include that function inside your python code to be invoked via the commands or action that you set your application to.
In short, use Python for purely less troubling dynamic meta extractions, string manipulation, piping output to any other file. Hope that helps.

Is it possible to package Selenium test cases into a runnable appliction

I am creating selenium test to test a web app. I also want to be able to use these test cases as a way for non technical users to automate the first few steps of the process. ~Is this possible?
If you are using testng, generate command to run XML from the command line and then copy the same command to .bat or .cmd file. By a click any user can run those tests/suite.
Of course you can, Selenium automates browsers, it is not a 'test library' you can use it in any program. Just write java program where you use selenium.
You can also write tests (in JUnit or TestNG or any other test runner) and run tests programmatically.

How to get selenium server running locally?

I need to have selenium server running in order to run some tests I'm creating in http://seleniumbuilder.github.io/se-builder/
This is not for the selniumIDE and not for a server grid, I need to be able to export from selenium builder and am directed to run them on a local selenium server, e.g. localhost:4444
I use the download page at http://www.seleniumhq.org/download/ but there isn't much info on basic stuff.
I see the link for the download and I can save the .jar file Now what? I don't know Java. Trying to click thru gets
[
[
How should I be compiling and then using it?
Selenium means different things depending on context.
Do you want to record/playback simple web browser interactions? You want SeleniumIDE or Selenium Builder. You need a standalone jar when replaying the tests from the command line; I think the docs tell you how but I couldn't find it. This small blog post tells you how. Essentially: download the Selenium Standalone Server jar file from SeleniumHQ and run it something like this:
java -jar c:\selenium\selenium-server-standalone-2.21.0.jar -htmlSuite "*firefox" "http://localhost:8080" "c:\test\my-test-suite.html" "c:\test\my-test-result.html"
(Note: even though it is called a "server", in this mode it does not listen on a port for incoming requests or anything like that; to most people's way of thinking, the jar file is actually a client in this mode, and the browser that it connects to is the server! The jar file does include a server, you're just not using it when executing a Selenese file like this.)
Do you want to run tests locally from your unit test runner (JUnit, NUnit, etc.?). You probably don't need a server. All the instructions are on this doc page.
Do you want to run the tests via a grid of multiple browsers, allowing you to distribute the load and do multi-browser testing easily? This is where Selenium server shines. Everything you need to know is on this doc page.

Using selenium grid to execute remote code

We looking to use Selenium grid to parallelize our tests but some of our tests need to run java code local to the testing machine. In other words as well as automating the browser we also need to run some java code on the test machine. Are there hooks in Selenium Grid that will allow us to do this?
PS we are also looking at Jenkins to setup our environment.
EDIT: To be clearer, the java code I need to execute does a get from the web application, downloading pdf files that we cannot do with selenium alone. It then does some processing on those PDF files. I suppose the processing could be done on the server hub but the downloading can't. Unless someone can explain how to download a pdf using selenium and save it to a given location?
Selenium cannot execute your java code in the remote control machine. It will get executed only in the hub machine. However, taking screenshot, deal with popup, uploading the files in a specific path can be taken care by Grid.

Selenium with SWFUpload

I tried to use Selenium for the automation testing script. The testing web page used SWFUpload for uploading. I don't see any api in Selenium to resolve the upload.
Here is the page: http://demo.swfupload.org/v220/multiinstancedemo/index.php
I found flash-selenium but it is not useful.
http://code.google.com/p/flash-selenium/
Thanks,
Jame
One way of uploading documents is by using autoscripts.
However, autoit scripts are only supported on a windows machine.
You need to do following:
Click on browse button.
Run the .exe autoit file.(exe file can be converted from autoit scripts).