Is it possible to login different nodes with different login ID's parallelly using selenium grid? - selenium

I am tiring to login to Gmail account with different user name with selenium grid (java) parallelly. I have 5 nodes each node should use different user name. All the user names are provided in excel. Can anyone help me to do this action?

Selenium Grid allows the execution of WebDriver scripts on remote machines (virtual or real) by routing commands sent by the client to remote browser instances. It aims to provide an easy way to run tests in parallel on multiple machines.
Selenium Grid allows us to run tests in parallel on multiple machines, and to manage different browser versions and browser configurations centrally (instead of in each individual test).
Selenium Grid is not a silver bullet. It solves a subset of common delegation and distribution problems, but will for example not manage your infrastructure, and might not suit your specific needs.
Please note Grid 3 is not supported anymore and the Selenium project recommends to use Grid 4

Related

is selenium grid a solution to my problem with executiontimes?

Hi all I am using TestNG framework for selenium webdriver scripts. I run them on Jenkins on two slaves one being windows the other being linux. I have close to 100 test cases and they take 2hrs 40 mins on each machine. I would want to speed up the execution time. will selenium grid be helpful in this case?
No. Selenium grid would not be the solution. Selenium grid can multiply the same action, not taking different actions in parallel.
You should look for the opportunities in test parallelization.
Selenium grid is designed to allow you to run test in parallel
The page says:
Selenium Grid allows us to run tests in parallel on multiple machines, and to manage different browser versions and browser configurations centrally (instead of in each individual test).
However it's not as easy as installing it and connecting up.
You'll need to ensure the rest of your framework and tests are capable of parallel execution. Most important part is to watch out for your test data e.g. if multiple tests rely on the same data source and they try and update it at the same time you'll get flaky results.
You're also capable of running tests in parallel on a local machine without selenium grid. If i were you i'd start with this first.
Typically most machines have the resources to run more than one browser - get it running locally before you go to far down the grid rabbit hole.
Here's a link for testng
Also worth a review is zalenium - a docker image that contains a grid + auto scaling nodes allowing easier browser control on a single machine.

Windows Authentication using Selenium Grid and Webdriver

I was asked a question :
Assume I have 4 machines and I need to execute a script in all the machines across all the browsers. How will I achieve that.
I told him the concept of Selenium Grid, where in we could set up a machine which acts like a hub, configure 3 more machines which would act like a node.
Using Desired Capabilities among others we could choose a browser type and version type in that and write a script.
But he asked me two things :
IN all the node machines how do you configure the Windows username and Password if the machine is locked. Can you write windows Authentication in the script.
Can I achieve testing different browser versions of same browser type in a single node?
Can I pass as a the browser type and browser version as a parameter
from hub to the node?
Can someone throw some light on these as I was unable to answer. Thanks.
Question 1: Is it really necessary for the machine to be unlocked for the test to start? The selenium node is a background process that listens for commands, and executes them on the browser, so I do not think this is necessary. If it is necessary due to your specific windows settings however, then no, you cannot do this from the selenium script obviously.
Question 2: Yes, you can test different browser versions of the same type on the same node. You can pass the browser name and version to the node. However, keep in mind that the node cannot know the location of the different browser versions, so you will also have to supply the path to the browser executable for your requested version

Executing the selenium tests from remote java application

We have are planning to design a system where we are planning to invoke the Selenium test that is present in a remote machine with url for testing. The selenium program should open 3 browsers for example IE, FF and Chrome and open the page and take a screenshot of it. Later These screenshots should be sent from this machine to the java application.
Is it possible to achieve this functionality ? If so could you please guide me on how to do this ?
Yes, you need to start a Selenium Grid/Node server on the remote machine that is configured to run all 3 browser types. That configuration isn't easy but it involves launching the grid from a .json config file. Then, your local program needs to just run the 3 tests either in 3 simultaneous threads, or one at a time using typical Selenium code.
Each test needs to define a Selenium Augmenter to get screenshots. There are lots of examples on Google.

Selenium And/Or TestSwarm?

I am new to testing, when doing some research these last few days i found 2 tools that enable testing a web application, here is what i understand so far:
Selenium provides a way to manipulate the browser, so in other terms it enables simulating user interaction on a webPage, we can write tests using PhpUnit-Selenium extension for example and it will make it possible to test our application as a real user would, after that those tests need to run on different browsers...
For TestSwarm i need to write my tests using tools such as (Qunit, Jasmine...) that are mainly focused on unit testing (not user interaction ...) and use TestSwarm server to push those tests to available browsers to run them (i think this is automatic so no need for a user to manually run theses tests)
My conclusion is that Selenium and TestSwarm are somewhat complementary as Selenium enables testing user interaction overall, and TestSwarm simplifies testing javascript cross Browser.
Am i getting this right?
I think you are on the right track, here is an excerpt from https://github.com/jquery/testswarm/issues/258
Okay, so you're using WebDriver and your test suite is a set of instructions (in what language do you have it stored now?) for the browser to execute (go to page X, click button Y, etc.).
Those are not unit tests but integration tests. They require bindings with the browser and/or the ability to execute code on the target computer. They can't be executed from within the browser (in that if I visit the url of your test suite in my browser, nothing happens as the driver instructions need to be run from outside the browser or from a plugin).
TestSwarm is not designed for these kind of integration tests, but for unit tests. A very different method that simply can't be performed by TestSwarm. Also, you wouldn't need any of TestSwarm's features for this and you'd miss things you need instead (like actual browsers and the ability to control them and extract the results). Where those browsers come from there usually is something like TestSwarm close by.
I'd recommend looking into SauceLabs and Jenkins (either self-hosted or perhaps a cloud based solution like CloudBees).
Check out:
• http://sauceio.com/index.php/2012/12/getting-the-most-out-of-selenium-with-cloudbees-and-sauce-labs/
• https://saucelabs.com/jenkins/1
• http://www.cloudbees.com/platform-service-saucelabsondemand.cb

selenium grid 2 ready, how do I send a "test" job to the remote server?

On my linux box somewhere in the United States, it's running Selenium Grid 2.
Currently 3 people will be regularly running parallel tests, but there's potential for more people to join and running more parallel tests....
now they are in other parts of the world, they need to submit an xml file which contains the test data, and the server needs to parse this and figure out the rules.
How can the client invoke a test to run on the remote server? via HTTP POSTing the xml file to the url in which the grid is running on?
Is it cheaper to just rent out a fast linux server and then buy more as number of parallel tests increase?
Or should I right off the bat, hook it up to Amazon ec2? If there are parallel tests on an ajax heavy web applications running 24/7, would it be cheaper to go with the single dedicated box or amazon? google app engine (no plugins for grid?)?
I am not sure I understood the xml submitting part in your question. However, I can tell you an example which will help to you understand how to submit the tests to grid.
Three people, PersonA, PersonB and PersonC are creating selenium tests in their local machine. They currently run the test using an ANT build (or something similar) against the selenium server jar which is in their local machine. In their code they would be having a line of code which tells which selenium instance should be used to run this test. This will be mostly like
new DefaultSelenium("localhost",port,browsername,URL)
Now these people want to move to selenium grid (1 or 2). Here is what they will have to do to use the grid
All they have to do is change the command
new DefaultSelenium("localhost",port,browsername,URL)
to
new DefaultSelenium("hubIPAddress",portInWhichHubWasStarted,browsername,URL)
Note:- browserName - Make sure there is a remote node registered in Hub for the same browserName.
Now all the commands will be sent to Selenium Hub and Hub would execute the commands using the remote nodes.
Hope this helps. Please post if you have any questions.