使用Geckodriver对VM进行Selenium测试

时间:2016-10-11 13:12:49

标签: selenium testing remote-server geckodriver

您好我一直在尝试在虚拟机上运行测试。我已经通过互联网,没有一个解决方案适合我。

我想在Windows虚拟机上打开firefox。这是我的代码:

   @BeforeTest
   public void launchapp() throws MalformedURLException
   {
       System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");

       String URL = "http://www.google.com";

         System.out.println(" Executing on FireFox");
         String Node = "http://XX.XX.X.XX:5555/wd/hub";
         URL url = new URL(Node);
         DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
         desiredCapabilities.setCapability("marionette", true);
         desiredCapabilities.setBrowserName("firefox");
         //driver = new FirefoxDriver(cap);

         driver = new RemoteWebDriver(url, desiredCapabilities);
         driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);


         driver.navigate().to(URL);
         driver.manage().window().maximize();

   }

我在virstual机器上遇到的错误是:

The path to the driver executable must be set by the webdriver gecko.driver system property....

在我的电脑上我只在控制台上看到它试图连接节点但它失败了:

Marking the node http://.... as down: cannot reach the node for 2 tries

Unregistering the node http://... because it's been down for XXX ms

并在Eclipse中:

org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, version=, platform=ANY}], required capabilities = null

你知道为什么这不起作用吗?我该怎么检查?

0 个答案:

没有答案