-1
我是Selenium的新手,只是试图用它打开浏览器,但这给我一段艰难的时间。每当我尝试运行下面的代码,它给了我这个错误:尝试使用Selenium运行简单脚本时发生错误
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "void", @ expected
Syntax error on token "]", :: expected after this token
Syntax error, insert "enum Identifier" to complete EnumHeader
Syntax error, insert "}" to complete EnumBody
at TestClass1.main(TestClass1.java:7)
我已经尝试了很多东西,但找不到任何东西。
public class TestClass1{
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public static void main(String[] args) {
// TODO Auto-generated method stub
//System.setProperty("webdriver.firefox.bin", "c:\\path\\to\\firefox.exe");
WebDriver driver = new FirefoxDriver();
driver.get("www.google.com");
driver.quit();
}}
}
为什么你对你的类体的进口? – hexafraction 2014-09-23 15:30:59
当你说你尝试了很多东西时 - 当你搜索到你遇到的错误时,你发现了什么? – anotherdave 2014-09-23 15:36:31
嗨Hexafraction谢谢你的帮助,它为我工作。 – 2014-09-25 07:01:36