Selenium Webdriver中的多个程序执行不起作用 [英] Multiple program execution in selenium webdriver is not working
问题描述
Selenium WebDriver中的多个程序执行不起作用.我编写了一个testNG xml文件和2个Java类.我试图从xml文件运行这两个Java类.但这不起作用.
Multiple program execution in selenium WebDriver is not working. I written one testNG xml file and 2 java classes. I tried to ran those two java classes from the xml file. But it's not working.
XML代码:
<suite name="Suite">
<test name="SIT">
<classes>
<class name="testng1.NewTest"/>
<class name="testng1.NewTest2"/>
</classes>
</test>
</suite>
现在"NewTest.java"类:
Now "NewTest.java" class:
package testng1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class NewTest {
public static WebDriver driver;
@BeforeTest
public void launch()
{
System.setProperty("WebDriver.ie.driver", "C:\\Users\\rprem\\Downloads\\IEDriverServer_x64_3.4.0\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
System.out.println("BeforeTest Method");
}
@Test
public void gmail()
{
driver.get("https://gmail.com");
System.out.println("Gmail was launched");
}
@AfterTest
public void quit()
{
driver.quit();
System.out.println("AfterTest Method");
}
}
现在"NewTest2.java":
Now "NewTest2.java" :
package testng1;
import org.testng.annotations.Test;
public class NewTest2 extends NewTest
{
@Test
public void yahoo()
{
driver.get("https://yahoo.com");
System.out.println("yahoo site was opened");
}
}
当我使用testng运行xml文件时,出现以下错误消息:
When I ran the xml file using testng,I got below error message:
错误消息:
失败的配置:@BeforeTest启动 java.lang.IllegalStateException:必须通过webdriver.ie.driver系统属性设置驱动程序可执行文件的路径;更多 信息,请参阅 https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver . 可以从以下位置下载最新版本 http://selenium-release.storage.googleapis.com/index.html 在com.google.common.base.Preconditions.checkState(Preconditions.java:738) 在org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124) 位于org.openqa.selenium.ie.InternetExplorerDriverService.access $ 000(InternetExplorerDriverService.java:32) 在org.openqa.selenium.ie.InternetExplorerDriverService $ Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) 在org.openqa.selenium.remote.service.DriverService $ Builder.build(DriverService.java:330) 在org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:288) 在org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:210) 在org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:154) 在testng1.NewTest.launch(NewTest.java:13) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498) 在org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) 在org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) 在org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) 在org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) 在org.testng.TestRunner.beforeRun(TestRunner.java:626) 在org.testng.TestRunner.run(TestRunner.java:594) 在org.testng.SuiteRunner.runTest(SuiteRunner.java:380) 在org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) 在org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) 在org.testng.SuiteRunner.run(SuiteRunner.java:289) 在org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 在org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 在org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) 在org.testng.TestNG.runSuitesLocally(TestNG.java:1226) 在org.testng.TestNG.runSuites(TestNG.java:1144) 在org.testng.TestNG.run(TestNG.java:1115) 在org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) 在org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) 在org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
FAILED CONFIGURATION: @BeforeTest launch java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:738) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124) at org.openqa.selenium.ie.InternetExplorerDriverService.access$000(InternetExplorerDriverService.java:32) at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330) at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:288) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:210) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:154) at testng1.NewTest.launch(NewTest.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) at org.testng.TestRunner.beforeRun(TestRunner.java:626) at org.testng.TestRunner.run(TestRunner.java:594) at org.testng.SuiteRunner.runTest(SuiteRunner.java:380) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) at org.testng.SuiteRunner.run(SuiteRunner.java:289) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) at org.testng.TestNG.runSuitesLocally(TestNG.java:1226) at org.testng.TestNG.runSuites(TestNG.java:1144) at org.testng.TestNG.run(TestNG.java:1115) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
SKIPPED CONFIGURATION: @AfterTest quit
SKIPPED: gmail
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.ie.driver system property; for more
信息,请参阅 https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver . 可以从以下位置下载最新版本 http://selenium-release.storage.googleapis.com/index.html 在com.google.common.base.Preconditions.checkState(Preconditions.java:738) 在org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124) 位于org.openqa.selenium.ie.InternetExplorerDriverService.access $ 000(InternetExplorerDriverService.java:32) 在org.openqa.selenium.ie.InternetExplorerDriverService $ Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) 在org.openqa.selenium.remote.service.DriverService $ Builder.build(DriverService.java:330) 在org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:288) 在org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:210) 在org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:154) 在testng1.NewTest.launch(NewTest.java:13) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498) 在org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) 在org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) 在org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) 在org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) 在org.testng.TestRunner.beforeRun(TestRunner.java:626) 在org.testng.TestRunner.run(TestRunner.java:594) 在org.testng.SuiteRunner.runTest(SuiteRunner.java:380) 在org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) 在org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) 在org.testng.SuiteRunner.run(SuiteRunner.java:289) 在org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 在org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 在org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) 在org.testng.TestNG.runSuitesLocally(TestNG.java:1226) 在org.testng.TestNG.runSuites(TestNG.java:1144) 在org.testng.TestNG.run(TestNG.java:1115) 在org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) 在org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) 在org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:738) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124) at org.openqa.selenium.ie.InternetExplorerDriverService.access$000(InternetExplorerDriverService.java:32) at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330) at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:288) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:210) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:154) at testng1.NewTest.launch(NewTest.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) at org.testng.TestRunner.beforeRun(TestRunner.java:626) at org.testng.TestRunner.run(TestRunner.java:594) at org.testng.SuiteRunner.runTest(SuiteRunner.java:380) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) at org.testng.SuiteRunner.run(SuiteRunner.java:289) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) at org.testng.TestNG.runSuitesLocally(TestNG.java:1226) at org.testng.TestNG.runSuites(TestNG.java:1144) at org.testng.TestNG.run(TestNG.java:1115) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
SKIPPED: gmail
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.ie.driver system property; for more
信息,请参阅 https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver . 可以从以下位置下载最新版本 http://selenium-release.storage.googleapis.com/index.html 在com.google.common.base.Preconditions.checkState(Preconditions.java:738) 在org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124) 位于org.openqa.selenium.ie.InternetExplorerDriverService.access $ 000(InternetExplorerDriverService.java:32) 在org.openqa.selenium.ie.InternetExplorerDriverService $ Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) 在org.openqa.selenium.remote.service.DriverService $ Builder.build(DriverService.java:330) 在org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:288) 在org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:210) 在org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:154) 在testng1.NewTest.launch(NewTest.java:13) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498) 在org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) 在org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) 在org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) 在org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) 在org.testng.TestRunner.beforeRun(TestRunner.java:626) 在org.testng.TestRunner.run(TestRunner.java:594) 在org.testng.SuiteRunner.runTest(SuiteRunner.java:380) 在org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) 在org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) 在org.testng.SuiteRunner.run(SuiteRunner.java:289) 在org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 在org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 在org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) 在org.testng.TestNG.runSuitesLocally(TestNG.java:1226) 在org.testng.TestNG.runSuites(TestNG.java:1144) 在org.testng.TestNG.run(TestNG.java:1115) 在org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) 在org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) 在org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:738) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124) at org.openqa.selenium.ie.InternetExplorerDriverService.access$000(InternetExplorerDriverService.java:32) at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330) at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:288) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:210) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:154) at testng1.NewTest.launch(NewTest.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) at org.testng.TestRunner.beforeRun(TestRunner.java:626) at org.testng.TestRunner.run(TestRunner.java:594) at org.testng.SuiteRunner.runTest(SuiteRunner.java:380) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) at org.testng.SuiteRunner.run(SuiteRunner.java:289) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) at org.testng.TestNG.runSuitesLocally(TestNG.java:1226) at org.testng.TestNG.runSuites(TestNG.java:1144) at org.testng.TestNG.run(TestNG.java:1115) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
SKIPPED: yahoo
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.ie.driver system property; for more
信息,请参阅 https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver . 可以从以下位置下载最新版本 http://selenium-release.storage.googleapis.com/index.html 在com.google.common.base.Preconditions.checkState(Preconditions.java:738) 在org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124) 在org.openqa.selenium.ie.InternetExplorerDriverService.access处获得$ 000(InternetExplorerDriverService.java:32) 在org.openqa.selenium.ie.InternetExplorerDriverService $ Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) 在org.openqa.selenium.remote.service.DriverService $ Builder.build(DriverService.java:330) 在org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:288) 在org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:210) 在org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:154) 在testng1.NewTest.launch(NewTest.java:13) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498) 在org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) 在org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) 在org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) 在org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) 在org.testng.TestRunner.beforeRun(TestRunner.java:626) 在org.testng.TestRunner.run(TestRunner.java:594) 在org.testng.SuiteRunner.runTest(SuiteRunner.java:380) 在org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) 在org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) 在org.testng.SuiteRunner.run(SuiteRunner.java:289) 在org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 在org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 在org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) 在org.testng.TestNG.runSuitesLocally(TestNG.java:1226) 在org.testng.TestNG.runSuites(TestNG.java:1144) 在org.testng.TestNG.run(TestNG.java:1115) 在org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) 在org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) 在org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:738) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124) at org.openqa.selenium.ie.InternetExplorerDriverService.access$000(InternetExplorerDriverService.java:32) at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330) at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:288) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:210) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:154) at testng1.NewTest.launch(NewTest.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146) at org.testng.TestRunner.beforeRun(TestRunner.java:626) at org.testng.TestRunner.run(TestRunner.java:594) at org.testng.SuiteRunner.runTest(SuiteRunner.java:380) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) at org.testng.SuiteRunner.run(SuiteRunner.java:289) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301) at org.testng.TestNG.runSuitesLocally(TestNG.java:1226) at org.testng.TestNG.runSuites(TestNG.java:1144) at org.testng.TestNG.run(TestNG.java:1115) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
===============================================
testng1
Tests run: 3, Failures: 0, Skips: 3
Configuration Failures: 1, Skips: 1
===============================================
===============================================
practice by packages
Total tests run: 3, Failures: 0, Skips: 3
Configuration Failures: 1, Skips: 1
===============================================
推荐答案
从xml
文件中删除以下行.因为您的班级NewTest2 extends NewTest
所以,不需要在这里写.
Remove this below line from your xml
file. Because your Class NewTest2 extends NewTest
So, no need to write here.
<class name="testng1.NewTest"/>
以此替换您的xml
文件.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite guice-stage="DEVELOPMENT" name="Test">
<test verbose="2" name="Dummy">
<classes>
<class name="testng1.NewTest2"/>
</classes>
</test>
</suite>
在IE Browser
中执行脚本之前,请更正这些设置.
Before going to execute your script inside IE Browser
, please correct these settings.
转到设置-> Internet选项->安全选项卡->设置此选项 为所有四个区域启用. (启用保护模式)
Go to settings -> Internet options -> Security tab -> Make this option Enable for all four zones. (Enable Protected Mode)
请参阅下面的图片以更改此设置.
Refer below Image for change this settings.
您的执行代码将是这样.
Your code of execution will be like this.
执行:-如果在xml文件上方运行,则代码将以这种方式执行.
Execution:- if you run above xml file, your code will execute this way.
1)BeforeTest方法
2)Gmail
3)雅虎
4)AfterTest方法
1) BeforeTest Method
2) Gmail
3) Yahoo
4) AfterTest Method
这篇关于Selenium Webdriver中的多个程序执行不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!