小编use*_*574的帖子

在PATH中找不到firefox二进制文件.确保安装了firefox

在Selenium Grid中我试图执行一个简单的程序,Cannot find firefox binary in PATH虽然我已经在我的代码中添加了二进制路径.
我的代码和错误如下.请帮忙.提前致谢.



package Sample;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
public class sample1 {
     WebDriver driver;
     String  BaseURL,NodeURL;
@BeforeTest
  public void beforeTest() throws MalformedURLException {
     BaseURL="www.google.com";
     NodeURL="http://192.168.10.162:5566/wd/hub";
     DesiredCapabilities capa =DesiredCapabilities.firefox();
     capa.setBrowserName("firefox");
     capa.setCapability("binary", "C:\\Users\\praveenraj.d\\AppData\\Local\\Mozilla Firefox\\firefox.exe");
     capa.setPlatform(Platform.ANY);
     driver=new RemoteWebDriver(new URL(NodeURL),capa);
  }
   @Test
  public void f() throws InterruptedException {
      driver.get(BaseURL);
      System.out.println(driver.getTitle());
      Thread.sleep(50000);
  }
  @AfterTest
  public void afterTest() {
      driver.quit();
  }
 }
Run Code Online (Sandbox Code Playgroud)


错误 …

java selenium selenium-grid selenium-webdriver

30
推荐指数
6
解决办法
14万
查看次数