2017-06-17 2 views
0

私のコードで "org.openqa.selenium.WebDriverException"というエラーの原因を見つけることができません原因を見つけて助けてくださいずっといい。まず、自分のコードを説明したいと思います。シンプルなコードで、「サインイン」リンクをクリックしてウェブサイトにアクセスし、テキストの「テキスト」テキストをクリックして登録します。私はこのコードでPage Factoryを使用しました。"org.openqa.selenium.WebDriverException"エラーコードに表示されます

I have 3 files. 
- Base file (Before and After methods) 
- Registration File (Object repository and methods) 
- Registration_Testcase File (Calling the methods) 

Note: Base and Registration Testcase classes are in one package and Registration is in another package. 

**Below is my code:** 

基本クラス

package testcases; 
import org.testng.annotations.BeforeTest; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.firefox.FirefoxDriver; 
import org.openqa.selenium.firefox.FirefoxProfile; 
import org.openqa.selenium.firefox.internal.ProfilesIni; 
import org.openqa.selenium.support.ui.WebDriverWait; 
import org.testng.annotations.AfterTest; 

public class Base { 

    public WebDriver driver; 
    public WebDriverWait wait; 

    @BeforeTest 
    public void beforeTest() { 
     ProfilesIni pro = new ProfilesIni(); 
     FirefoxProfile ffProfile = pro.getProfile("vishvesh"); 
     ffProfile.setAcceptUntrustedCertificates(true); 
     ffProfile.setAssumeUntrustedCertificateIssuer(false); 
     String base_url = "http://automationpractice.com/index.php"; 
     System.setProperty("webdriver.gecko.driver", "G:/Workplace/AutomationSetupFiles/Geckdriver/geckodriver.exe"); 
     driver = new FirefoxDriver(); 
     driver.get(base_url);  
    } 

    @AfterTest 
    public void afterTest() { 
     driver.close(); 
    } 
} 

登録クラス

package pages; 

import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.support.FindBy; 
import org.openqa.selenium.support.PageFactory; 
import org.openqa.selenium.support.ui.ExpectedConditions; 

import testcases.Base; 

public class Registration extends Base{ 

    @FindBy(xpath="//*[@id='header']/div[2]//div[1]/a") 
    WebElement SignIn; 

    @FindBy(xpath="//input[@id='email_create']") 
    WebElement Registration_Email; 


    public Registration(WebDriver driver){ 
     this.driver=driver; 
     PageFactory.initElements(driver, this); 
    } 

    public void ClickSignIn(){ 
     //wait.until(ExpectedConditions.visibilityOf(SignIn)).click(); 
     SignIn.click(); 
    } 

    public void EnterEmail(String y){ 
     //wait.until(ExpectedConditions.visibilityOf(Registration_Email)).click(); 
     Registration_Email.click(); 
     Registration_Email.sendKeys(y); 
    } 


} 

登録のTestCaseクラス

私は何を得る0

エラー: 失敗したコンフィギュレーション:いくつかの互換性の問題があったように私はこの問題を解決しているように見えてきた

@BeforeTest beforeTest 
org.openqa.selenium.WebDriverException: 
Build info: version: 'unknown', revision: '8c03df6', time: '2017-03-02 09:32:39 -0800' 
System info: host: 'LAPTOP-SCJ4OHK5', ip: '192.168.1.3', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131' 
Driver info: org.openqa.selenium.firefox.FirefoxDriver 
Capabilities [{moz:profile=C:\Users\VISHVE~1\AppData\Local\Temp\rust_mozprofile.XaA5YbSD8jeh, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0.3, platformVersion=10.0, moz:processID=7440, browserName=firefox, platformName=windows_nt}] 
Session ID: 1ad0b6c1-bb5c-4306-afa6-b4e3dcb62ac1 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127) 
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93) 
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42) 
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163) 
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) 
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604) 
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325) 
    at testcases.Base.beforeTest(Base.java:30) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    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) 
+0

ヒントを使用しています) 'を' get'関数で呼び出します。デバッガを使用してもう一度確認してください。代わりに "google.com"を入力してください。 –

+0

@Tuyen Nguyen、スクリプトはブラウザでウェブサイトを開きますが、何か起こらないリンクをクリックすることになっていますどうやって.. –

答えて

0

は、見えました。例外はtestcases.Base.beforeTest(Base.java:30で `である:今、私は次のような構成に

  • セレン3.4
  • FirefoxブラウザのV48
  • geckodriver 17の
関連する問題