EdgeDriver with Selenium and Java can be interrupted by a modal window dialog box, causing the test script to pause its execution

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.

Answer №1

Following thorough research and numerous attempts at finding solutions, it has become evident that this issue is indeed a significant obstacle. It seems that Microsoft has not yet enhanced the WebDriver sufficiently to distinguish between the root file explorer and the web file explorer. For additional information, please refer to: Browser File Upload Issue with Selenium

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Why isn't this code for hiding the animation and displaying it not functioning properly?

Why isn't this animation from display none to block working properly? The initial code appears as follows, and it functions correctly: $(".box_outer").stop().animate({top: '25px' , opacity: 1}, 100); When I add display: none; to the class ...

Uploading Boolean Values from Switch Input (React/Typescript)

I'm facing an issue while trying to post the state value of a switch input toggle control. Whenever I use the submitRecommendation() function through a button click, I encounter a JSON parse error: Cannot deserialize instance of `boolean` out of START ...

Scrape data using Python Selenium even when the "Load More" button does not alter the URL

I've been experimenting with this code in an attempt to continuously click a "Load More" button until all the page results are displayed on the website: from selenium import webdriver import time from selenium import webdriver from selenium.webdriver. ...

Tips for creating JavaScript validation for the Amount input field (in the format 22.00) in an ASP.NET application

In this aspx page using ASP.NET 4.0, there is a text box where users can enter a rate. The requirement is that only numbers are allowed to be entered. For example, if the user enters 22, it should display as 22.00. If the user enters 22.5, it should displa ...

Utilizing Regex to Authenticate a CAGE Code

Our task is to create a RegEx pattern that can accurately validate a CAGE Code A CAGE Code consists of five (5) positions. The code must adhere to the following format: The first and fifth positions must be numeric. The second, third, and fourth position ...

Node.js/Firebase function to delete an item from a JSON object and update the existing items

I'm currently facing a challenge with updating a JSON file in Firebase after deleting an item using the .delete() function. Here is the original JSON data before deletion: "data": [ { "position": "3", ...

onmouseleave event stops triggering after blur event

I am facing an issue with a mouseleave event. Initially, when the page loads, the mouseleave event functions correctly. However, after clicking on the searchBar (click event), and then clicking outside of it (blur event), the mouseleave functionality stops ...

Gaining entry to information while an HTML form is being submitted

After a 15-year break, I am diving back into web development and currently learning Node.js and ExpressJS. I have set up a registration form on index.html and now want to transfer the entered data to response.html. However, when I hit Submit, the form is p ...

First render does not define useEffect

Why am I experiencing an issue here? Whenever I attempt to retrieve data from my API, it initially returns undefined during the first render, but subsequent renders work correctly. const [data, setData] = useState([]) useEffect(() => { const fe ...

Node.js: Module not found error

When I run the command below to install a module from the NPM registry: npm install dc All files are successfully installed, but upon running the script dc, it fails to resolve a dependency. $ node web-test.js module.js:340 throw err; ^ Error: ...

Can we condense the code to create a more concise and efficient function?

Can someone help me refactor this code snippet below into a function and combine the two IF statements? Many thanks! let value = productDetails.recentPurchaseDate; if (!productDetails.salesPrice && !productDetails.recentPurchaseDate) { value = false; } ...

Guide to integrating a deterministic game loop with tick-based mechanics

My current project involves creating a "simple" 3D game using Three.js and incorporating a network framework for multiplayer functionality in the future. After some research, I found that many "action" games utilize a "tick" based game loop to sync clients ...

Can you explain the significance of this code snippet 'true <=> false'?

Today I came across this piece of code: true <=> false. I'm a bit confused by it and don't really understand how it works. If anyone could shed some light on this expression for me, I would greatly appreciate it. For reference, this code ...

Error encountered when uploading mp3 file to S3 node due to size limitation

Currently, I am utilizing Node to transmit mp3 files to Amazon S3. However, after uploading the file, it shows a size of 9.0 Bytes and when attempting to play the audio from the public URL, it does not work as expected. Here is my current code snippet: rou ...

When utilizing a SAX parser with JAXB 2, XML attributes may not be properly unmarshalled

After generating my Java classes from XSD using the XJC tool, unmarshalling was functioning correctly with the default settings. However, upon switching to a SAX parser implementation (specifically from SAXSource here: http://docs.oracle.com/javase/6/docs/ ...

Tips for displaying a restricted quantity of items in a list according to the number of li lines used

My approach involves using a bulleted list to display a limited number of items without a scrollbar in 'UL' upon page load. On clicking a 'more' button, I aim to reveal the remaining items with a scrollbar in UL. The following code acco ...

HighStocks should show categories instead of dates

The zoom function in HighCharts is what drew me to it initially. Everything was working perfectly until I encountered an issue that I can't seem to resolve. Here's my code snippet: http://jsfiddle.net/ma50685a/16/ $(function() { // Crea ...

Progressively scanning a designated item within a <table> using Selenium in Python

I have encountered a challenge in retrieving information from a dynamic table that undergoes periodic changes. The HTML structure is as follows: <table class="the_table_im_reading"> <thead>...</thead> <tbody> <tr id="uc_ ...

How can you automate clicking a button and then performing a specific action through code?

In my current coding project, I am attempting to automate the process of clicking on a tab through a script in order to reveal additional divs on the webpage. Once these divs are revealed, I need to perform certain actions on them. My code currently looks ...

What is the process for collecting API Data from a specific URL?

So, I have a link to an API that displays a JSON file of stats. How can I use Java to easily extract the value of "winstreak" located under player.stats.Bedwars.winstreak? Input: Link to API Output: 6 ...