Cannot instantiate class with TestNG Selenium

2019-08-05 10:06发布

When I run the code, I get the following error:

Cannot instantiate class mypackage.GoogleSearch

How can it be fixed?

Code:

package mypackage;

import org.testng.annotations.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;


public class GoogleSearch {
    public String url = "http://www.google.com/";
    public WebDriver driver = new FirefoxDriver();

  @Test
  public void search() {      
      driver.get(url);          
  }
}

1条回答
Juvenile、少年°
2楼-- · 2019-08-05 11:05

I got it working, apparently I needed to install the stand-alone server: https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.39.0.jar&can=1&q= If anyone could explain why it'd be great, with Visual Studio I just had to install selenium client

查看更多
登录 后发表回答