我想從本地上傳文件而不使用Auto it工具。所以我用Action event
來點擊瀏覽按鈕。我對下面的代碼發送使用sendKeys
文件的路徑:org.openqa.selenium.UnhandledAlertException:模態對話框存在:
"driver.findElement(By.xpath("//input[@type='file']")).sendKeys("path of file");"
我得到"org.openqa.selenium.UnhandledAlertException: Modal dialog present: "
錯誤。
我無法處理這個異常。
請任何人能幫助我在做這個...
我認爲有一個彈出窗口,你需要關閉它之前sendkeys。 – noor
元素可能正在填充。嘗試與a)driver.manage()。timeouts()。implicitlyWait(60,TimeUnit.SECONDS); (或b) WebElement element = driver.findElement(By.id(「ELEMENT_ID」)); wait.until(ExpectedConditions.visibilityOf(element)); – AVA