How to launch a browser on a specific computer when using selenium webdriver? - selenium

I have started a selenium server hub on a linux computer, and two selenium nodes, one on windows xp and the other on windows 7. Both nodes are registered to the hub and both of them have firefox, chrome and ie.
How can I specify the IP address to tell the the selenium server, that only the browser of the computer with that specific IP should be started? For example, I want to test a web application with firefox only in windows xp, not windows 7. How can I configure the webdriver capabilities, so that only firefox in windows xp will be started?
Thanks in advance.

All the webdriver capabilities are setup in the script. In the script you can specify what browser and operating system you want to use.
The most common way is the setCapabilitiy()
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setBrowserName("firefox");
cap.setCapability("platform", "WINDOWS XP");
The only thing you cannot specify is the ip address of the node. It is seleniums job to choose any available configuration for your test.
If you want to separate the capabilities from the scripts then you can specify them in a separate json or xml file and load them when you start your tests.

Related

How to launch the browser on client side using selenium webdriver

I am new to selenium. I am developed one application using a selenium web driver for doing some actions on the webpage. It's perfectly working when I am running locally i.e., it launches a browser in my machine. I deployed this application on a VM server so the script runs on the server(launched browser in VM Ware Machine), not on the client-side. Can anyone help me with how can I launch the browser on the client-side?
You have to create Hub and Nodes using selenium grid
You can refer this link to see step by step
http://www.seleniumeasy.com/selenium-tutorials/how-to-configure-selenium-grid
Your server will be hub and your client machine will be node
If you trigger from one machine, you can launch a browser on another machine using the selenium-grid concept
But both machines are under the same LAN.
Here you want to execute on the client machine. It is not possible, because your machine and client machine won't be under the same network

Selenium chrome remote web driver deosn't work on vpn

I'm using Selenium remote web driver for gui testing. The server is on Linux, the browser is on Windows. Everything works fine when I'm using a 'regular' connection. The first issue is that when I switch from cable to wifi, I have to restart the computer for the remote webdriver to work. But the main problem, is that when connecting to vpn, nothing works at all - the browser won't even open. Has anyone encountered anything like this in the past?
Let me know if more details are required..
Thanks :)
Chrome doesn't allow extensions while running /controlled by selenium. I end up using VPN application(hide me,norvpn) which globally change ip for the running applications on my machine.

Need a machine to run selenium Grid test cases

I would like to check my selenium grid test cases on a server(any machine other than localhost).I need chrome , firefox and IE browsers in the server. Is there any way to do this ? I checked few sites like koding.com , but it is only offering me unix interface,I need full windows/Ubuntu interface.
Please let me know if there is any other method to execute my test cases ?
VirtualBox is good and works well for grid tests, I expect it to be a fairly common solution. Same IP is not a problem as you make it work with port forwarding on your desktop. For example you should manage to build a grid like the following:
-role hub on your Windows host on port 4444
-role node on an Ubuntu VM with port forward 5556 in VirtualBox, for Firefox
-role node on an OSX VM with port forward 5557 in VirtualBox, for Safari
-role node on a Windows VM with port forward 5558 in VirtualBox, for IE and Chrome
node with socat+flynnid.py on an Android emulator with port forward 5559
maybe also iPhone Simulator from inside OSX VM (I don't remember if I made it work with grid)
The Selenium Grid "user interface" as you say, is the same , whether it is Linux or Windows. The only difference is that on Linux you won't have an IE driver.
What you do is run a Grid Hub on your local machine and then register "Node" servers on each remote machine. Each Node server can run any combination of web browsers that you mentioned and it is also capable of running them simultaneously (if your test suite was programmed carefully).
The .jar file that you start the Grid Hub with is the same .jar file you use to start the Nodes. The only difference is that each Node will have a .json config file with it that explains the configuration of that server such as where the IE and Chrome binary files are located at on the remote server, what browsers it supports, and how many threads it can handle.
Look at the documentation I wrote (for Grid hub config) on the GitHub "Selenium documentation" site.

Windows service that interacts with desktop screen resolution

I configured Jenkins as Selenium Grid and some Jenkins Nodes as Selenium Nodes (controlled by Jenkins Selenium plugin).
The nodes are connected with the option "Let Jenkins control this Windows Slave as Windows Service".
The service is defined automatically at the node as "interact with desktop".
Jenkins slave enables Selenium remote driver service
The problem is that the resolution of UI tests is really low (1036 x 780) where we need (1600x1200).
Opening an RDP session doesn't help since the service was started by Jenkins.
How to change the default resolution of windows service that can interact with Desktop?
I had the same problem as yours. Difference was I also have GUI automation besides Selenium tests. I ended up installing VNC service on all the nodes and wrote a script to change the desktop resolution before running any tests. However the highest resolution by doing that we got is 1280x1024, which resolved my problem.
If you don't mind giving up running Jenkins Slave as Windows Service you can use this way:
Jenkins on Windows and GUI Tests without RDC
Still - that would make you maintain an open RDP session that runs Jenkins JNLP process... So that solution is working, but not very optimal.

Should hub have Browser installed

Is it possible to run the hub in the VM machine which doesnt have broweser?. I have my RC machines with browsers.
You can try the WebDriver approach - there is HTMLUnitDriver which should do the job. See javadoc:
http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/htmlunit/HtmlUnitDriver.html
The hub does not need a browser. You can even run the hub on a different OS than your RC machines.
For example we run our hub on linux, without any browsers, and our RC machines on Windows with browsers.