在我的Angular应用程序中,我正在识别一个带有id的元素。但它在执行期间及以下不承认是我的详细信息。
在我的屏幕上,我有一个带贷款值的贷款号码控件,其复选框为已选中状态。我必须弄清楚在屏幕启动后是否检查了这个贷款号码。我已使用其标识的(id)编写脚本,但在执行期间它无法识别,并且它会抛出“元素不可见”错误。请帮忙..
<section class="verification-element" data-ng-show="$ctrl.value || $ctrl.vmodel=='isIvrVerified'" aria-hidden="false">
<div class="verification-element--nameValue" data-ng-switch="$ctrl.type">
<label for="loanNumberid" class="verification-element__name ng-binding">LOAN NUMBER</label>
<!-- ngSwitchWhen: address -->
<!-- ngSwitchWhen: percentage -->
<!-- ngSwitchWhen: select -->
<!-- ngSwitchDefault: --><span class="verification-element__value ng-binding ng-scope" id="loanNumberValueId" data-ng-switch-default="">0553101437</span><!-- end ngSwitchWhen: -->
</div>
<div class="verification-element--checkbox saturn-checkbox">
<input class="checkBoxFirstPanel ng-pristine ng-untouched ng-valid ng-empty" type="checkbox" name="loanNumber" id="loanNumberid" data-ng-checked="true" data-ng-model="$ctrl.thing" data-ng-click="$ctrl.checkedElement({name: $ctrl.vmodel, value: $ctrl.thing})" checked="checked" aria-invalid="false" style="">
<label for="loanNumberid"></label>
</div>
</section>
当我与我的开发人员核实时,他说他已将此复选框控件的“id”设置为“loanNumberid”,我也编写了该脚本。但当我检查它实际上显示<lable>
控件时,我对此感到困惑。这是我的硒代码
@FindBy(id = "loanNumberid")
public static WebElement chkloan;
chkloan.click();
我得到的错误是......
org.openqa.selenium.ElementNotVisibleException: element not visible
(Session info: chrome=56.0.2924.76)
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 23 milliseconds
Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55'
System info: host: 'MUS5CG6030CWS', ip: '10.219.18.222', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_92'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed), userDataDir=C:\Users\par964\AppData\Local\Temp\scoped_dir17000_14241}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=56.0.2924.76, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: a8514260e4e55f5ff09b60d0196223f4
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
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.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:50)
at com.sun.proxy.$Proxy15.click(Unknown Source)
at com.capitalone.Pages.NewVerificationModal.clickCheckBoxes(NewVerificationModal.java:360)
at com.capitalone.Steps.Saturn_Login.selectElements(Saturn_Login.java:490)
at ?.And I select fields on verification panel(src/test/resources/feature/SmokeCICD/NotesMemo.feature:12)