I am new to browser automation and learning selenium. I have managed to set up jar dependencies and the driver dependency too. It is opening the webpage.., detecting the loading of the page and also detecting element is available to click. But it has opened a select file dialog box
and i am unable to select file via selenium.
Here is my java code :
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
WebDriver driver = new ChromeDriver(options);
driver.get("https://xyz.abc.pqr");
try
{
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("element_id_1")));
System.out.println("Loaded and in....");
WebElement AttachMenu = driver.findElement(By.className("Class_1"));
AttachMenu.click();
System.out.println("Clicked Attach menu....");
// <input type="file" accept="image/*,video/*" multiple="" style="display: none;">
// As you can see above input element is not having any id or class
// How do i sendkeys to above input element that has opened dialog
// this is the question...
}
catch (TimeoutException e)
{
System.out.println("Element not found...");
}
// driver.quit();
IT IS NOT UPLOAD IT IS JUST SELECTION OF FILE; I WILL CLICK ON UPLOAD BUTTON THEREAFTER...
Any help / inputs will be appreciated and thank you in advance for giving your valuable time over this question.