2017-08-25 8 views
0

私はある時点でフレームの入力フィールドに文字列を挿入しようとするgeb-cucumberシナリオを持っています。複数の入力要素によるElementNotVisibleException

問題はフレームが多くの同じ入力(!!)何らかの理由があると私は$( "入力[名前= XXX])を得た場合クロームデベロッパーツールコンソールで

<input aria-labeledby="userid-label" aria-required="true" autocomplete="off" class="error input" tabindex="51" type="text" id="el3fd4c7bd50db061c" maxlength="48" aria-invalid="true" aria-describedby="gwt-uid-63"> 
<input aria-labeledby="userid-label" aria-required="true" autocomplete="off" class="error input" tabindex="51" type="text" id="el3fd4c7bd50db061c" maxlength="48" aria-invalid="true" aria-describedby="gwt-uid-63"> 
<input aria-labeledby="userid-label" aria-required="true" autocomplete="off" class="error input" tabindex="51" type="text" id="el3fd4c7bd50db061c" maxlength="48" aria-invalid="true" aria-describedby="gwt-uid-63"> 

のようなものに見えることですそれは私の目的は、単に要素を取得しに文字列を挿入することであるとして、次のメッセージ

VM5451:1 Uncaught SyntaxError: Unexpected token # in JSON at position 0 
    at JSON.parse (<anonymous>) 
    at i (application-2a3801d….js:11) 

が、これは無関係であるかもしれない投げ続ける、その後のelemを返します。

getArrayField(userIdField) << "aabbcc" 

getArrayFieldは回避策を試みているようですが、実際にはうまく機能しません。

テストでは、あなたはまた、使用される識別サービスですhttps://service.nemid.nu/dk-en/#log_on_to_self-serviceで問題を再現することができ、次のスタックトレース

org.openqa.selenium.ElementNotVisibleException: element not visible 
    (Session info: chrome=60.0.3112.113) 
    (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.11.12-200.fc25.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) 
Command duration or timeout: 0 milliseconds 
Build info: version: '3.5.2', revision: '10229a9', time: '2017-08-21T17:29:55.15Z' 
System info: host: 'iob-4finance', ip: '192.168.175.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.11.12-200.fc25.x86_64', java.version: '1.8.0_131' 
Driver info: org.openqa.selenium.chrome.ChromeDriver 
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5), userDataDir=/tmp/.org.chromium.Chromium.2ksxEt}, takesHeapSnapshot=true, pageLoadStrategy=normal, unhandledPromptBehavior=, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=60.0.3112.113, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}] 
Session ID: 85a17386757827e393d4f83772a88959 

    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215) 
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167) 
    at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40) 
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:82) 
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:45) 
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164) 
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) 
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641) 
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:275) 
    at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:99) 
    at geb.navigator.NonEmptyNavigator$_leftShift_closure30.doCall(NonEmptyNavigator.groovy:448) 
    at geb.navigator.NonEmptyNavigator.leftShift(NonEmptyNavigator.groovy:447) 
    at geb.content.TemplateDerivedPageContent.leftShift(TemplateDerivedPageContent.groovy:27) 
    at com.ofg.loans.dk.at.web.site.pages.IdentificationPage.logIntoNemIdApp(IdentificationPage.groovy:40) 
    at com.ofg.loans.dk.at.web.site.pages.IdentificationPage$logIntoNemIdApp.call(Unknown Source) 
    at com.ofg.loans.dk.at.web.site.stepdefs.nemid.NemIdStepDefs$_run_closure3.doCall(NemIdStepDefs.groovy:47) 
    at ✽.And user logs into NemId from the webapp(com/at/web/features/.feature:13) 

で失敗します。私は、適切な解決策への助けや指示を使うことができました。ありがとう

答えて

0

サンプルHTMLに名前フィールドが表示されません。名前のフィールドがある場合でも、Chromeデベロッパーツールでこれを使用してみてください:

$("input[name='xxx']") 

そして、これをゲブで:

$("input", name: "xxx") 

また、あなたがの一部として#を使用している可能性がありそうです名。

$("input[name='xxx']").eq(0) 
:要素が同じ順序で常にある場合、あなたは eq selectorを使用することができますです \#

別のオプションを使用して文字をエスケープすることを確認します

関連する問題