Selenium webdriverでファイルをアップロードする必要があります。 しかし、私はのようなものを使用している場合:タグ<input type = "file">の属性 "hidden"を削除する方法
driver.findElement(By.xpath("//input[@type='file']")).sendKeys(file.getAbsolutePath());
その後、私はエラーを持っている:
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 128 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
だから私は、私はjsファイルを使用して属性隠しを削除する必要があると思いますし、私はこのコードが見つかりました:
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("document.getElementsByTagName('*')[0].removeAttribute('hidden');");
しかし、私のために働いていません。
これは、私が働いコードです:
<label name="file" ng-model="file" ngf-accept="pattern" ngf-pattern="pattern" ngf-select="uploadSubmit($file)" ng-disabled="isUploadDisabled()" type="button" class="button button--large ng-pristine ng-untouched ng-valid ng-empty">
<span translate="" class="button__text">Загрузить из файла .xls</span>
<input type="file" hidden="" ng-disabled="isUploadDisabled()">
</label>
私は、コードの一部を追加しました、あなたは私は私の答えを更新した –
particulary私の状況をチェックしてください可能性があり、私がチェックしていると、それはので、気にしてください投稿 – Jigar7521