我正在使用硒3.0.0-beta4版本。试图在我的项目上配置geckoDriver的设置。我将Maven和TestNG与Java一起使用。
import java.util.concurrent.TimeUnit;
import org.testng.annotations.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.WebDriver;
public class GmailSignupAutomation {
private WebDriver driver;
private String baseUrl;
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {System.setProperty("webdriver.gecko.driver","D://software_/geckodriver-v0.11.1-win64/geckodriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
**driver = new FirefoxDriver(capabilities);**
baseUrl = "https://accounts.google.com/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testGoogleAccountLoginForm() throws Exception {
driver.get(baseUrl + "//SignUp?service=mail&continue=https://mail.google.com/mail/?pc=topnav-about-en");
driver.findElement(By.id("FirstName")).clear();
driver.findElement(By.id("FirstName")).sendKeys("HOSSAIN");
}
@AfterClass(alwaysRun = true)
public void tearDown() throws Exception {
driver.quit();
}
}
这是输出:
1476438749160 geckodriver INFO于2016年10月14日在127.0.0.1:39530上监听org.openqa.selenium.remote.ProtocolHandshake createSession
INFO:尝试双向对话,假设远端的Postel法则成立
1476438749613 mozprofile :: profile INFO使用配置文件路径C:\ Users \ HOSSAI〜1.MAH \ AppData \ Local \ Temp \ rust_mozprofile.e9aWwalq9rWK
1476438749656 geckodriver :: marionette信息启动浏览器C:\ Program Files \ Mozilla Firefox \ firefox.exe
1476438749683 geckodriver :: marionette INFO在本地主机上连接到木偶的信息:61519 2016年10月14日下午org.openqa.selenium.remote.ProtocolHandshake createSession
INFO:退回到直接的W3C远端连接
1476438752490 mozprofile :: profile INFO使用配置文件路径C:\ Users \ HOSSAI〜1.MAH \ AppData \ Local \ Temp \ rust_mozprofile.D6FkME6daU3V
1476438752499 geckodriver :: marionette信息启动浏览器C:\ Program Files \ Mozilla Firefox \ firefox.exe
1476438752535 geckodriver :: marionette INFO在本地主机上连接到木偶的信息:61527 2016年10月14日下午org.openqa.selenium.remote.ProtocolHandshake createSession
信息:退回到原始的OSS JSON Wire Protocol。 1476438757062 mozprofile :: profile INFO使用配置文件路径
C:\ Users \ HOSSAI〜1.MAH \ AppData \ Local \ Temp \ rust_mozprofile.FHKHmYIM3lXI
1476438757069 geckodriver :: marionette信息启动浏览器C:\ Program Files \ Mozilla Firefox \ firefox.exe
1476438757127 geckodriver :: marionette INFO在本地主机上连接到木偶的信息:61557
[实用程序]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ Default suite \ Default test.xml
[实用程序]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \默认套件存在:true
失败的配置:@BeforeClass setUp org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话。所需功能=功能[{marionette = true,browserName = firefox,version =,platform = ANY}],所需功能=功能[{}]
内部版本号:'未知',版本号:'3169782',时间:'2016-09-29 10:24:50 -0700'系统信息:主机:'XYZ',ip:'101.140.178.123',OS。名称:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.8.0_102'
驱动程序信息:driver.version:FirefoxDriver位于org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)上的org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)上的org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80) org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)上的.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.startSession .java:242),位于org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:129),位于org.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:247),位于org.openqa.selenium.firefox。 org.openqa.selenium.firefox上的FirefoxDriver。(FirefoxDriver.java:235).org.openqa上的org.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:226)上的FirefoxDriver。(FirefoxDriver.java:230)。 selenium.firefox.FirefoxDriver。(FirefoxDriver.java:124),位于SeleniumAutomation.GoogleSignupAutomation.GmailSignup位置sun.reflect.NativeMethodAccessorImpl.invoke的Automation.setUp(GmailSignupAutomation.java:39)invoke0(位置sun.reflect.NativeMethodAccessorImpl.invoke(本地方法)的位置sun.reflect.DelegatingMethodAccessorImpl.invoke(未知源)的java.lang org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:100)的org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)的.reflect.Method.invoke(未知源) org.testng.inorg.Invoker.invokeConfigurations(Invoker.java:216)org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143)org.testng.org.org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:169)。 org.testng.TestRunner.privateRun(TestRunner.java:746)在org.testng.TestRunner.run(TestRunner.java:600)处在org.testng.SuiteRunner.runTest的internal.TestMethodWorker.run(TestMethodWorker.java:108) (SuiteRunner.java:366)在org.testng.SuiteRunner.runSequentially(Su org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)上的iteRunner.java:361)org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52上的org.testng.SuiteRunner.run(SuiteRunner.java:268)上的)的org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)的org.testng.TestNG.runSuitesSequentially(TestNG.java:1264)的org.testng.TestNG.runSuitesLocally(TestNG.java:1189)的org.testng。 org.testng.TestNG.run(TestNG.java:1076)的org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)的.TestNG.runSuites(TestNG.java:1104)在org.testng.remote。 org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)上的RemoteTestNG.initAndRun(RemoteTestNG.java:152)
失败的配置:@AfterClass tearDown在SeleniumAutomation.GoogleSignupAutomation.GmailSignupAutomation.tearDown(GmailSignupAutomation.java:55)处在SeleniumAutomation.GoogleSignupAutomation.GmailSignupAutomation.tearDown(GmailSignupAutomation.java:55)在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处在sun.reflect.NativeMethodAccessUnImpl.invoke在org.testng.internal的org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:100)的java.lang.reflect.Method.invoke(未知源)的sun.reflect.DelegatingMethodAccessorImpl.invoke(未知源)处。 org.testng.internal.Invoker.invokeConfigurations(Invoker.java:216)位于org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143)位于org.testng.internal处的Invoker.invokeConfigurationMethod(Invoker.java:515) org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:115)处的org.testng.TestRunner.privateRun(TestRunner.java:746)处的.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:217)。跑(TestRunner.java:600)在org.testng.SuiteRunner.runTest(SuiteRunner.java:366)在org.testng.SuiteRunner.run在org.testng.SuiteRunner.privateRun(SuiteRunner.java: 319)位于org.testng.SuiteRunner.run(SuiteRunner.java:268)位于org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)位于org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)附近。 org.testng.TestNG.runSuitesLocally(TestNG.java:1189)位于org.testng.TestNG.runSuites(TestNG.java:1104)处于org.testng.TestNG.runSuites(TestNG.java:1104)位于org.testng.TestNG.run (TestNG.java:1076)在org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)在org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152)在org.testng.remote.RemoteTestNG。主要(RemoteTestNG.java:57)
跳过:testGoogleAccountLoginForm
Default test
Tests run: 1, Failures: 0, Skips: 1
配置失败:2,跳过:0
=============================================默认套件总数测试运行:1,失败:0,跳过:1配置失败:2,跳过:0
[TestNG] org.testng.reporters.XMLReporter@3b938003花费的时间:50毫秒[TestNG] org.testng.reporters.EmailableReporter2@475e586c花费的时间:12毫秒[实用程序]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default suite \ toc.html [Utils]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \存在默认套件:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default suite \ Default test.properties [Utils]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default suite存在:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default suite \ index.html [Utils]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default套件存在:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default suite \ main.html [实用程序]目录D:\ Projects \ Automation \ Googl eSignupAutomation \ test-output \ old \ Default套件存在:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default套件\ groups.html [Utils]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default套件存在:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default套件\ classes.html [Utils]目录D:\ Projects \存在Automation \ GoogleSignupAutomation \ test-output \ old \ Default套件:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default套件\ reporter-output.html [Utils]目录D: \ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default套件存在:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default套件\ methods-not-run.html [ [实用程序]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \默认套件存在:true [实用程序]临时ng创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default suite \ testng.xml.html [Utils]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ Default suite存在:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old \ index.html [Utils]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ old存在:true [TestNG]作者:org.testng.reporters.SuiteHTMLReporter@780cb77:95毫秒[实用程序]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ junitreports \ TEST-SeleniumAutomation.GoogleSignupAutomation.GmailSignupAutomation.xml [实用程序]目录D:\存在Projects \ Automation \ GoogleSignupAutomation \ test-output \ junitreports:true [TestNG] org.testng.reporters.JUnitReportReporter@3a079870花费的时间:106 ms [TestNG] org.testng.reporters.jq.Main@17c1b花费的时间: 241 ms [实用程序]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-outpu t \ testng-failed.xml [实用程序]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output存在:true [Utils]尝试创建D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ Default suite \ testng- failed.xml [实用程序]目录D:\ Projects \ Automation \ GoogleSignupAutomation \ test-output \ Default套件存在:true [TestNG] [FailedReporter传递通过的时间= 0失败= 0跳过= 0]:8毫秒
我是一名优秀的程序员,十分优秀!