0

嗨,我一直在尝试在虚拟机上运行测试。我浏览了互联网,没有一个解决方案对我有用。

我想在 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();

   }

我在虚拟机上遇到的错误是:

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

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

4

0 回答 0