java – Not able to click the “Choose File” button in selenium webdriver. The upload window for file is not opening

I was supposed to click a ” Choose File ” button on a website and it is supposed to open a window that allows me to choose the file but the window does not open even if I code it to click the element.

System.setProperty("webdriver.chrome.driver","C:Usersshasheclipse-wo"); 

WebDriver driver=new ChromeDriver();

driver.navigate().to("http://the-internet.herokuapp.com/upload"); 

Thread.sleep(5000);
WebElement uploadPhotoBtn = driver.findElement(By.xpath("//input[@id='file-upload']")) 

uploadPhotoBtn.click();

after this upload, the window should open but it’s not.

Read more here: Source link