Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98503

Unable to upload file using selenium java

$
0
0

I try to upload a pic on this site but exception comes up. Here is my code.

public static void main(String[] args) throws InterruptedException {


    System.setProperty("webdriver.chrome.driver", "I:\\Selenium\\chromedriver.exe");
    WebDriver driver= new ChromeDriver();
     JavascriptExecutor js = (JavascriptExecutor) driver;
    driver.get("https://jpg2png.com");
    driver.manage().window().maximize();
    js.executeScript("window.scroll(0,100)");


    WebElement Pic=driver.findElement(By.id("pick-files"));
    String js1 = "arguments[0].style.height='auto'; arguments[0].style.visibility='visible';";

    Pic.sendKeys("D:\\University Work\\6th Semester\\IAP\\outline.jpg");

    Thread.sleep(10000);
    driver.quit();
}

}

The browser open website also open but uploading doesn't happen. type="file" is also not there in html code. The Exception is: Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: element not interactable


Viewing all articles
Browse latest Browse all 98503

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>