数値フィールドにデータを入力できません。「要素を非表示、無効、または読み取り専用にすることはできません」というエラー メッセージが表示されます。
以下のコードを見つけてください。
driver.findElement(By.name(OR.getProperty("txtDealerName_ID"))).sendKeys(AccName+"_"+r[1]);
driver.findElement(By.name(OR.getProperty("txtDealerAddress_ID"))).sendKeys("126 - City Cross");
String dealZipID = OR.getProperty("txtDealerZip_ID");
WebElement dealZipInput = driver.findElement(By.id(dealZipID));
dealZipInput.clear();
dealZipInput.sendKeys(String.valueOf(79081));
dealZipInput = driver.findElement(By.id(dealZipID));*/
new Actions(driver).sendKeys(driver.findElement(By.id(OR.getProperty("txtDealerZip_ID"))), "").perform();
Thread.sleep(3000);
以下に表示されるエラーメッセージを見つけてください。
FAILED: Dealers
org.openqa.selenium.InvalidElementStateException: Element must not be hidden, disabled or read-only (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 63 milliseconds
Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:08:38'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_15'
Driver info: driver.version: RemoteWebDriver
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.ErrorHandler.createThrowable(ErrorHandler.java:175)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:459)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:245)
at org.openqa.selenium.remote.RemoteWebElement.clear(RemoteWebElement.java:112)
at com.ode.Admin.Dealer_Admin.Dealers(Dealer_Admin.java:114)
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:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
at org.testng.TestNG.run(TestNG.java:1036)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
関連する HTML コード:
<table id="Table2" width="100%" height="27" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td background="Common/Images/table2_01.gif"> </td>
<td width="98%" bgcolor="#f3f9fd">
<table width="100%" cellspacing="1" cellpadding="1" border="0">
<tbody>
<tr>
<td>
<table width="95%" cellspacing="0" cellpadding="4" border="0">
<tbody>
<tr width="50%">
<tr width="55%">
<tr>
<td>
<table class="text" width="58%" cellspacing="0" cellpadding="1" border="0">
<tbody>
<tr>
<tr>
<td valign="baseline">
<input id="ctl00_MasterPlaceHolder_TxtZip" type="hidden" value="" name="ctl00$MasterPlaceHolder$TxtZip">
<input id="ctl00_MasterPlaceHolder_TxtZip_p" type="hidden" name="ctl00_MasterPlaceHolder_TxtZip_p" value="">
<input id="igtxtctl00_MasterPlaceHolder_TxtZip" class="form" type="text" onkeypress="javascript:IsNumeric()" style="" editid="ctl00_MasterPlaceHolder_TxtZip">
</td>
<td valign="top">
<td width="30%" valign="baseline">
<td valign="top">
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<tr>
</tbody>
</table>
この問題で私を助けてください。助けていただければ幸いです。