簡體   English   中英

在上傳窗口彈出JAVA之后無法上傳文件

[英]Unable to upload file by after upload window pop-up JAVA

在Stackoverflow上使用Selenium Webdriver上傳文件時,我已經看到很多問題和解決方案。 但是,以下情況都不起作用。 實際上,上傳窗口彈出窗口沒有執行任何操作。 好心提醒

這是我的代碼:

WebDriverWait wait = new WebDriverWait(driver, 100);
            //Upload Doc #1 
            wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='lottery']/div[3]/div[2]/input[1]"))).click();
            //Upload Doc #2 
            wait.until(ExpectedConditions.elementToBeClickable(By.id("filePicker"))).click();
            //Upload Doc #3 
            WebElement fileInput = driver.findElement(By.id("filePicker"));
            fileInput.sendKeys("D:\\SobetAuto\\5star.txt");

試試看,看看是否可行:

driver.findElement(By.id("filePicker")).sendKeys("D:/SobetAuto/5star.txt");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM