Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将Selenium脚本导出为jar,我可以使用cmd提示符运行,但没有主清单_Java_Eclipse_Selenium_Junit - Fatal编程技术网

Java 将Selenium脚本导出为jar,我可以使用cmd提示符运行,但没有主清单

Java 将Selenium脚本导出为jar,我可以使用cmd提示符运行,但没有主清单,java,eclipse,selenium,junit,Java,Eclipse,Selenium,Junit,这就是我目前拥有的,我正在尝试导出它,但我没有任何主清单,也无法为其分配类。真的需要帮助,我愿意捐款给任何能给我看电视的人,告诉我如何让我的脚本成为一个可执行的.jar,我可以用cmd提示符运行 您只需使用main方法创建main类,并指向testclass 请参见下面的我的代码: import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; im

这就是我目前拥有的,我正在尝试导出它,但我没有任何主清单,也无法为其分配类。真的需要帮助,我愿意捐款给任何能给我看电视的人,告诉我如何让我的脚本成为一个可执行的.jar,我可以用cmd提示符运行

您只需使用
main
方法创建
main
类,并指向
testclass

请参见下面的我的代码:

import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.regex.Pattern;

public class Hello extends SeleneseTestCase { 
    private Selenium selenium;

    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "http://bakersfield.craigslist.org/search/sss?query=plumbers&sort=rel");
        selenium.start();
    }

    @Test
    public void testPlumbers() throws Exception {

    }

    @After
    public void tearDown() throws Exception {
       selenium.stop();
    }

}
希望有帮助

public static void main(String[] args) {
JUnit junit = new JUnit();
junit.setTestClasses(new Class[] { Hello.class });
junit.run();
}