I am in the process of creating a test script for our web application to test the upload functionality of a profile picture using Microsoft Edge and EdgeDriver. However, I am facing an issue where the script stops running completely after initiating the click operation on the add photo button. I suspect that it may be related to a parent/child window or JavaScript problem, but I have been unable to resolve it despite my efforts. The script works fine in Chrome, Firefox, and IE11. The code snippet below should trigger a modal window by clicking the button, select the desired image file path, and paste it into the dialog box.
Below is the relevant portion of the code:
driverElement = driver.findElement(By.xpath("//span[text()='Add Photo']"));
actions.moveToElement(driverElement).click().build().perform(); //click button for modal window
//find the image and upload it
pathToImage = new StringSelection("C:\\path\\to\\image");
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(pathToImage, null);
bot = new Robot();
Thread.sleep(500);
bot.keyPress(KeyEvent.VK_CONTROL);
bot.keyPress(KeyEvent.VK_V);
bot.keyRelease(KeyEvent.VK_CONTROL);
bot.keyRelease(KeyEvent.VK_V);
Thread.sleep(500);
bot.keyPress(KeyEvent.VK_ENTER);
bot.keyRelease(KeyEvent.VK_ENTER);
Following the click operation, the execution halts, even in debug mode when attempting to manually move to the next line of code.
I would greatly appreciate any assistance with this issue.