-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