I got the page with the simple html-code (see it here: pageCode.txt )
and am trying to upload an image and then find it's name in page source code using javascript. When I do such manipulations in non-headless mode, everything OK, but in headless mode there is an unexpected result.
Code is here:
Non-headless mode:
JBrowserDriver driver = new JBrowserDriver(Settings.builder().headless(false).buildCapabilities());
driver.get("http://localhost:8080/html/pageother.html");
driver.findElement(By.id("uploadFile")).sendKeys("D:\\1.jpeg");
System.out.println(((JavascriptExecutor) driver).executeScript("return document.getElementById('uploadFile').files[0].name;"));
Result in console : 1.jpeg
Headless-mode:
JBrowserDriver driver = new JBrowserDriver(Settings.builder().headless(true).buildCapabilities());
driver.get("http://localhost:8080/html/pageother.html");
driver.findElement(By.id("uploadFile")).sendKeys("D:\\1.jpeg");
System.out.println(((JavascriptExecutor) driver).executeScript("return document.getElementById('uploadFile').files[0].name;"));
I got the page with the simple html-code (see it here: pageCode.txt ) and am trying to upload an image and then find it's name in page source code using javascript. When I do such manipulations in non-headless mode, everything OK, but in headless mode there is an unexpected result. Code is here:
Non-headless mode:
Result in console : 1.jpeg
Headless-mode:
Result in console: D