Does selenium grid runs only Selenium command or also code chunk from different library - selenium

I have done my automation in Robotframework and I am using many libraries like Selenium2Library, Sikuli Library, HTTP Library, OS library and few more.
When I am running test on Selenium Grid, it invokes the browser on node and runs those steps which are from Selenium.
However, it does not run commands from Sikuli Library. Is selenium grid capable of running keywords from different libraries?

No, the selenium grid only works with selenium. The selenium grid is a server much like a web server. It listens for specific commands, and performs those commands. It will only respond to commands from selenium clients.

When using Sikuly in Robot Framework it is necessary to first setup the external sikuly server and then connect to it from Robot Framework. Typically this is a localhost connection, but connecting to an external host is also possible.
When using Selenium Grid, a connection is made to an anonymous node and thus the host to which the Sikuly server is runnning as well. Did a quick check in google and found that getting the hostname/IP of the running node from the hub is possible. Using the code example here I think it should be possible to create a direct connection to the Sikuly server.

Related

Is Selenium a security vulnerability?

I'm learning Selenium but I am concerned that the Webdriver (Chromedriver.exe, Geckodriver.exe) seems to open a port for communication functioning as a proxy between the selenium code and the browser. I don't want to expose myself to any vulnerabilities and would prefer some form of direct browser communication. I've viewed several solutions, but selenium just seems to be the reigning champion.
It appears that some form of what I am looking for was present with PhantomJS, but that seems to be no longer supported. This leaves me two options:
-Find a browser that selenium can communicate directly with without the aid of Webdriver.
-Find a way to completely restrict that port that it seems to open up so it does not allow connections from anybody on the network and no one can connect to my local machine.
Any suggestions folks?

Robot Framework executing test on RDP client

I have my robotframework setup on my PC.
I would like to connect to a remote windows client, have it open a browser and access a URL.
Verify that the pages has loaded.
Pretty basic but since I am new to RF, I wanted to know how that would work.
For Linux machines, I would use the SSHLibrary and just execute commands (wget) but for the windows machine, I need to use the browsers.
Do I need RF installed on the destination client RDP?
Do I need the webdrivers for each browser on the client RDP?
How would I go about logging in the Windows machine through RDP?
After Logging in with RDP, I run the same "open broswer" with broswer and URL?
Thanks!!!
The use case you describe - a browser to be opened & controlled on a remote machine, is precisely what Selenium solves.
Though in day-to-day work or debugging we are usually starting a local browser, SE is preliminary designed for remote execution. So head to www.selenium.dev, and focus on the Grid - that's the component you are after.
I'm that approach, answers to your specific questions:
no, you need Robot Framework and selenium library on the local machine, and only selenium & webdriver on the remote.
you don't need the drivers on the client - the selenium library is all you communicate with in your code; you need them installed in the remote only.
on the local you will get the logs of the webdriver commands execution; actual browser manipulation logs are only on the remote and the hub (but these are really debugging ones, everything high-level for the functional execution is local).
you don't really log into RDP with this approach (RDP is totally out of the picture here), and yes - your code is the same as running on local browser - Open Browser, Get Text, etc - but, executed on a remote machine.
If you want to see why 1) and 2), head to the answer over here (shameless plug 🙂)

What is the difference between Selenium Server and Selenium RC?

Selenium Webdriver - For interacting directly with browser
Selenium RC - Interacts with browser through a Server
If i need to test remotely using Web-driver, i need to use Selenium Server
So when we say Selenium Server in third point, does it mean then the
same server used by Selenium RC?
Is selenium server already included with selenium RC? If need to do automation using selenium RC, do i need to download Selenium Server separately?
Selenium Remote Control (RC) and Selenium WebDriver both are test automation tools supporting different programming languages but come with some critical differences.
Selenium RC
Till a couple of years back Selenium RC was an important component in the Selenium test suite. It was the testing framework that enabled a QA or a developer to write test cases in any programming language in order to automate UI tests for web applications against any HTTP website. Selenium RC comprised of two parts:
Client libraries for the preferred Language Binding Art.
A server that launches and destroys web browsers automatically.
Selenium RC’s architecture was a bit complicated as:
Developer/QA personal needed to install and launch a separate application called Selenium Remote Control Server before running test scripts.
The Selenium RC server acted as a mediator between the browser and Selenium commands.
The sequence of execution was:
The Selenium RC server injected a Javascript program known as Selenium Core into the browser client.
Once the Selenium Core program was injected, it started receiving instructions from the RC server based on test scripts. Selenium Core executed all these instructions as JavaScript commands.
The web browser executed all the commands given by Selenium Core and returns the test summary back to the Selenium RC server.
But there were limitations as follows:
Selenium RC Server's architecture was pretty complicated.
Execution of test scripts was time-consuming as Selenium RC uses JavaScript commands as instructions to the browser which resulted in slow performance.
API’s were less object-oriented.
There was no support for headless browsers.
All these limitations of Selenium RC Server led to the development of the new robust automation framework Selenium WebDriver.
WebDriver
From Selenium perspective, the WebDriver Interface is similar like a agreement which the 3rd party Browser Vendors like Mozilla, Chrome, Internet Explorer, Safari, etc have to adhere and implement the same. This would in-turn help the end-users to use the exposed APIs to write a common code and implement the functionalities across all the available Browsers without any change.
This usecase
To execute your testcases:
Locally: Selenium Client (jars) which is a bunch of API's would suffice your need.
On Remote machines(Selenium Grid): Selenium Server would solve your purpose.
You can find a relevant discussion in What is difference between Selenium Standalone Server and Java selenium Jar files

How can anyone run access Selenium test scripts without having to install/run it locally?

I am looking for ways to set up like a central 'hub' for Selenium in my work, allowing anyone to access in within the company. For example, Tester A writes test scripts, the Person B can run without having to manually copy over the test scripts to their local workstation)
So far, I've only thought of installing Selenium in a VM which will then execute as per normal. But if I run Selenium Grid, it will run VMs within VM (?). My only concern with VMs is that it'd run slowly.
If anyone can think of a better solution or recommendation please do give me some advice. Thank you in advance.
One idea. You can create an infrastructure combining Jenkins/Selenium/Amazon.
The following is my solution from another post.
You can do it with a grid.
First of all you need to create a Selenium hub with an EC2 ubuntu 14.04 AMI without UI and link it as a jenkins slave to your Jenkins master. Or as directly a master. What you want. Only command line. Download Selenium Server standalone. (be careful on downloading the version. If you Download the Selenium3Beta, things could change). Here you can configure the HUB. You can also add the Selenium Hub as a service and configure to run automatically at server start. its important that you open the Selenium default port (or the one that you configured) so the nodes can connect to it. You can do that on the Amazon EC2 console when you have created your instance. You just need to add a security group with an inbound rule for TCP in the port you want for the IPs you want.
Then, you can create a Windows server 2012 instance server (for example, that's what I did), and do the same process. Download the same version for Selenium and the chromedriver (there is no need to download any firefoxdriver for Selenium versions before Selenium3). Generate a txt file and prepare the Selenium command to link to the HUB as a NODE. And convert it to *.bat in order to execute it. If you want to run the bat at start you can create a service with the task scheduler or use NSSM (https://nssm.cc/). Don't forget to add the rules to the security groups for this machine too!
Next, create the Jenkins server. You can use the Selenium Hub as the Jenkins master or as a slave.
Last step is configuring a job to be run in the Jenkins-Selenium machine. This job needs to be linked to your code repository (git, mercurial...) Using the parametrized build plugion for jenkins you can tell that job to pull the revision you want (where every developer can pull the revision with the new changes and new tests) and run the Selenium tests in that build with the current breanch/revision and against one unique selenium. You can use ANT or Maven to run the Selenium tests in Jenkins.
May be it's complicated to understand because there are so many concepts here but it's robust and it works fine!
If you have doubts, tell me!
If Internet Explorer is not one of the browsers on which you must run your automation tests, I would recommend that you consider docker selenium.
Selenium is providing pre-configured docker images for both Selenium Hub and Node ( refer here for more information ). For making use of docker selenium all you need to do is find a machine (preferably unix machine), install docker on it by following instructions detailed here and then start the hub and node by starting off those containers. In the case of docker you can literally transform a VM (or) a physical machine into a VM farm and yet not have to worry about slowness etc., because I believe docker is optimised for these and it runs your VM as a process.
Resorting to using Amazon cloud for running your selenium nodes is all fine, but if you have corporate policies that prevent in-coming traffic from the internet into your intranet region, then I am not sure how far Amazon cloud would be useful.
Also remember that Jenkins is not something that is absolutely required but is more of a good to have part in the setup because it would let anyone run their tests from a web UI. This will however require that all your tests are checked-in and made available in a central version control system in your organization.
PS : The reason why called out Internet Explorer as an exception is because IE runs only on windows and there are no docker images (yet) for windows. All the docker images are UNIX based images.

How to invoke test in remote machine using selenium JS Grid

I am new to Selenium and I am trying to execute test in remote machine using Selenium Grid and Javascript (in Node Js) I am now able to connect to remote machine from js.
In Java, we use RemoteWebDriver and give Node machine URL. there are plenty of examples in Google
how will we do the same from Javascript. can any one please provide me step by step procedure to Invoke Sample tests in Node Machine from Hub Machine.
Many thanks
Vijay Bhargav