Selenium Grid, Vagrant, unable to run tests from Eclipse -
i attempting automate our testing using selenium , selenium grid 2. have create virtualbox vm , packaged vagrant box. using simple batch scripts, want run on jenkins ci server, can start vagrant box,but get:
c:\seleniumserver>vagrant bringing machine 'default' 'virtualbox' provider... ==> default: importing base box 'ie_vagrant.box'... ==> default: matching mac address nat networking... ==> default: setting name of vm:seleniumserver_default_1436811491763_573 ==> default: clearing set network interfaces... ==> default: preparing network interfaces based on configuration... default: adapter 1: nat default: adapter 2: bridged ==> default: forwarding ports... default: 22 => 2222 (adapter 1) ==> default: booting vm... ==> default: waiting machine boot. may take few minutes... default: ssh address: 127.0.0.1:2222 default: ssh username: vagrant default: ssh auth method: password default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... default: warning: connection timeout. retrying... timed out while waiting machine boot. means vagrant unable communicate guest machine within configured ("config.vm.boot_timeout" value) time period. if above, should able see error(s) vagrant had when attempting connect machine. these errors hints may wrong. if you're using custom box, make sure networking working , you're able connect machine. common problem networking isn't setup in these boxes. verify authentication configurations setup properly, well. if box appears booting properly, may want increase timeout ("config.vm.boot_timeout") value. i can start selenium hub, , selenium node , register. can ssh vagrant box after done telling it cannot connect. have setup cygwin , openssh on box.
when try run testng test eclipse :
error forwarding new session error forwarding request connect 10.0.2.15:5566 [/10.0.2.15] failed: connection timed out: connect.
here relevant bits.
start node
java -jar lib/selenium-server-standalone-2.46.0.jar -role webdriver -hub http://localhost:4444/grid/register -browser browsername="chrome",version=any,platform=windows,maxinstances=5 -dwebdriver.chrome.driver="c\seleniumdrivers\chromedriver.exe" start hub
java -jar selenium-server-standalone-2.46.0.jar -role hub vagrantfile:
vagrant.configure(2) |config| config.vm.boot_timeout = "300" config.ssh.username = "vagrant" config.ssh.password = "vagrant" config.vm.network "public_network" config.vm.box = "ie_vagrant.box" config.vm.provider "virtualbox" |vb| # display virtualbox gui when booting machine vb.gui = true # # customize amount of memory on vm: # vb.memory = "1024" end and here test:
package com.hiiq.qa.testing.gen2; import static org.junit.assert.assertequals; import java.net.malformedurlexception; import java.net.url; import org.openqa.selenium.by; import org.openqa.selenium.platform; import org.openqa.selenium.webelement; import org.openqa.selenium.remote.desiredcapabilities; import org.openqa.selenium.remote.remotewebdriver; import org.openqa.selenium.support.ui.expectedconditions; import org.openqa.selenium.support.ui.webdriverwait; import org.testng.annotations.beforeclass; import org.testng.annotations.test; public class gridtest { private static remotewebdriver driver; @beforeclass public void setup() throws malformedurlexception { desiredcapabilities capability = new desiredcapabilities(); //capability.setbrowsername("chrome"); capability.setbrowsername(desiredcapabilities.chrome().getbrowsername()); capability.setplatform(platform.windows); //capability.setversion(""); capability.setjavascriptenabled(true); driver = new remotewebdriver(new url("http://10.70.1.28:4444/wd/hub"), capability); driver.get("http://10.1.6.112:8383"); } @test public void logintest(){
check tutorial if box setup, virtualbox guest additions: https://dennypc.wordpress.com/2014/06/09/creating-a-windows-box-with-vagrant-1-6/
vagrant , vagrant ssh should work properly.
then setup vagrantfile port forwarding:
vagrant.configure(2) |config| config.vm.boot_timeout = "300" config.ssh.username = "vagrant" config.ssh.password = "vagrant" config.vm.network "public_network" config.vm.box = "ie_vagrant.box" config.vm.network "forwarded_port", guest: 4444, host: 4444 config.vm.network "forwarded_port", guest: 8383, host: 8383 config.vm.provider "virtualbox" |vb| # display virtualbox gui when booting machine vb.gui = true # # customize amount of memory on vm: # vb.memory = "1024" end end contact services in tests localhost:4444 , localhost:8383.
Comments
Post a Comment