How to connect selenium grid on other machine? - selenium

Here what i have done :
1) created testcase in selenium IDE - TestNg format( local system)
2) altered in Eclipse
3) Installed selenium grid on different machine (call ex 123.123.12.12 - linux)
4) Trying to run build.xml from local system
Default Selenium(host, port,browser, url)
Now its not connecting to 123.123.12.12 for runnin test case
what i have to do? Is it i am missing something or what is the procedure to achive this scenario?.
Thanks a lot.
By.
Mani

Download Selenium Grid on the different machines that are needed.(One to run Hub (Hub) and other to launch the RC instances(RC1 & RC2))
Example:
- Hub: 192.168.1.10
- RC1: 192.168.1.1
- RC2: 192.168.1.2
Launch the hub
a. Log in the machine you want to use as the hub (192.168.1.10).
b. Enter “ant launch-hub” command to launch the hub.
Launch RC1 :
a. log in the machine you want to launch the first RC instance (192.168.1.1)
b. enter “ant -Dport=5556 -Dhost=192.168.1.1 -DhubURL=http://192.168.1.10:4444 launch-remote-control”
Launch RC2 :
a. log in the machine you want to launch the first RC instance (192.168.1.2)
b. enter “ant -Dport=5556 -Dhost=192.168.1.2 - DhubURL=http://192.168.1.10:4444 launch-remote-control”
Enter http://192.168.1.10:4444/console link in address bar of browser and verify that ports are available.
Now run the tests.
a. Log in the host machine 192.168.1.10.
b. Enter “ant run-demo-in-parallel” command.

Related

Selenium Standalone Servers giving error "DefaultRemoteProxy unknown version,Connect to 10.0.2.15:5566 [/10.0.2.15] failed: connect timed out"

Selenium Grid Testing:
I have installed virtual box in my system and I am trying to use my local system as hub and the windows machine in the virtual box as node.
Whatever the selenium standalone server I use ( I tried a lot of versions) but it is always giving me the error "DefaultRemoteProxy unknown version,Connect to 10.0.2.15:5566 [/10.0.2.15] failed: connect timed out" on the grid console.
In the Command Prompt initially it is saying that the node is registered successfully but after some time it is saying " Marking the node http://10.0.2.15:5566 as down: cannot reach the node for 2 tries".
I have attached the screenshot. Because of this the tests are failing.
I have disable the windows firewall as well on both local and virtual box windows systems. But still no luck.
Is there anything wrong I am doing?
Can someone please help me with this?
Selenium Grid Console:
After trying a lot, I got the answer finally. This is related to network setup between my local host and the VM.
In VMBox, under the settings for a particular system, under network I have added one more adapter which is "Host-only adapter" in addition to the NAT and it resolved my problem.

How to restrict access to Selenium Standalone Server instance?

I have an instance of Selenium Standalone server in a virtual Widows box to run my tests on. It's being started in the following way:
java -jar selenium-server-standalone-2.46.0.jar -D"webdriver.chrome.driver"=chromedriver_2.13.exe -D"webdriver.ie.driver"=IEDriverServer_2.44.exe
Today I've noticed in the output some unexpected lines. The tests are running in the night and after that I see following:
08:46:20.197 INFO - Couldn't proxy to http://www.cv7.waw.pl/108258/Dachy/artykul.html because host not found
11:12:07.873 INFO - Couldn't proxy to http://g1nkaku.bieszczady.pl/damy-rade-zespol-na-wesele-bydgoszcz because host not found
11:49:49.204 INFO - Couldn't proxy to http://www.swiat.opt.waw.pl/Kryszyn/planeta-102-7/ because host not found
None of my tests were accessing any of such links, especially at these timestamps, and I have no idea where it can come from. My assumption is that someone found out the link to this instance of Selenium server and was sending requests through it.
What are my options to restrict access to Selenium server? Are there any options to request some custom login/password for all clients of this server? It's being used by several people in our team from multiple locations, so IP based checks are not an option.

In Robotframework how do I select a specific selenium grid node

I have selenium grid working with local and remote nodes from a test started in robotframework. I do not want to control selenium startup from within the robot test, I just want to say give me access to a selenium-node that is using a gateway which is the device under test(DUT). I want to in essence access specific nodes based on desired_criteria ~= mgmt in testbed1, client-interface in testbed1. Do I need a grid per testbed? It seems I need to associate a grid with a specific testbed and have another selenium running for the management interface.
Client ----------- DUT --------- Server
node | | mgmt interface
192.168/24 | |
| |
localhost ---- 10.0.1.1
hub + node + robot runner
I tried specifying platform=LINUX for client-node and platform=UNIX for local-node and thats not working in Open Browser. Now attempting use of robotframework_selenium2library, since I thought it was a drop in!
https://github.com/detro/ghostdriver/blob/master/README.md may provide a way to seperate instances, but it is still one instance running on a specific node, if I disable firefox on the client browsers and use that for manager access it will give me what I need - (hack! hack! hairball).
The key to solve this is to know which instance of selenium you are refering to when you call open_browser and that can be controlled by being explicit refering to the Selenium remote RC client_web.open_browser or by using Keyword Set Library Search Order.
*** Settings ***
Library SeleniumLibrary 120 ${CLIENT_IP} ${SELENIUM_SERVER_PORT} WITH NAME client_web
*** Variables ***
${MANAGER_BROWSER} Firefox
${BROWSER} Firefox
*** Test Cases ***
Verify Two Browsers Using Search Order
[Setup] Test Case Setup
[Tags] noncritical
Set Library Search Order SeleniumLibrary
${wb_index} = Open Browser ${DUT} ${MANAGER_BROWSER}
Set Library Search Order client_web
${wb_index} = Open Browser ${facebook} ${BROWSER}
Maximize Browser Window
Select Window main
Wait Until Page Contains ${page text} 10s
Log browser-index:${wb_index}
Comment Set suite variable Manager_Browser with call to open specific browser
[Teardown] Local Test Case Teardown

SeleniumRC with Jenkins

I wrote some junit test cases using seleniumrc . I am trying to integrate the test cases with Jenkins.
I installed seleniumrc-plugin for eclipse.I am unable to add the test cases to jenkins.
In Jenkins--> COnfigureProject --> Build Environment --> Create Seleniumrc instance ,I entered all the details for
Host , Port ,Browser ,OS
After that,I don't know what to choose for Build. I tried going through this source
https://wiki.jenkins-ci.org/display/JENKINS/SeleniumRC+Plugin
but couldnt figure out a way. Can anyone please explain me in detailed what to do next?
Try to configure Selenium manager and Remote Agents according to pt. 1 and 2.
After that on Jenkins CI configure Host and Port which must point to machine where "Selenium manager instance" is launched (it can be the same or another machine)

Selenium Grid + Jenkins Infrastructure execution

Pardon me for the lengthy description:
I have the following infrastructure where I am attempting to deploy the Selenium grid via Jenkins. For the sake of simplicity, I am using simplified IP addresses.
Machine 1 (Jenkins):
IP: 1.1.1.1
Machine 2 (The Test Script + The Firefox RC instance resides on this)
IP: 2.2.2.2
Machine 3 (The IE RC instance resides on this)
IP: 3.3.3.3
Now, I am starting instances of RC as follows:
Machine 2:
RC 1: ant -Dport=5555 -Denvironment=*firefox -Dhost=2.2.2.2 -DhubURL=http://1.1.1.1:4444 launch-remote-control
Machine 3:
RC 2: ant -Dport=5556 -Denvironment=*iexplore -Dhost=3.3.3.3 -DhubURL=http://1.1.1.1:4444 launch-remote-control
After doing this, I am able to establish connection on the Jenkins Selenium console for both Machine 2 and Machine 3.
As far as my test script (residing solely on Machine 2) is concerned -
For firefox,
selenium = new DefaultSelenium("1.1.1.1",4444,"*firefox","http://mytestURL.com")
For IE,
selenium = new DefaultSelenium("1.1.1.1",4444,"*iexplore","http://mytestURL.com")
The problem is that I unable to get the test script to execute on Machine 3, where the IE instance resides.
What settings do I have to make in the DefaultSelenium object to get the test script residing on Machine 2 to execute on Machine 3, via the Jenkins grid?
Thanks for looking.
The problem was with the host's IP address on Machine 3. This works as expected.