How to deal with Chrome's notification for downloading multiple files on "www.xyz.com" in automation using Robot Framework and SeleniumLibrary

Currently I am facing a challenge in my automation testing process. I am trying to download 3 files with a single button click when utilizing Robot Framework with SeleniumLibrary and writing code in VSCode. Upon clicking the button, Chrome displays a popup that says "insert domain wants to: Download Multiple Files" and gives the options to Allow or Decline. My goal is to allow for all 3 files to download successfully.

Popup Image from Chrome:

I have attempted to use the Press Key or Handle Alert keywords provided by the SeleniumLibrary in Robot Framework but unfortunately, these methods did not work as expected.

I also tried launching Chrome with different arguments to bypass this popup, but so far have been unsuccessful. Additionally, I explored modifying preferences in a file that chromedriver uses upon launch, however, I could not locate the specific file used by chromedriver.

Although the SeleniumLibrary offers the ability to execute JavaScript, I do not have much experience with JavaScript and would require guidance on how to start integrating JavaScript into my automation process.

I am struggling with handling this alert and despite researching online resources, I have not found a solution yet. Any assistance with this matter would be highly appreciated!

Answer №1

In my experience, the solution that worked for me using Robot Framework with Google Chrome version 89.0.4389.72 (Official Build) (64-bit) was:

    ${prefs} =    Create Dictionary    download.default_directory=${download_directory}    plugins.always_open_pdf_externally=${TRUE}
...    **profile.default_content_setting_values.automatic_downloads=${1}**   download.prompt_for_download=False

Therefore, you can implement: profile.default_content_setting_values.automatic_downloads=${1}

Answer №2

It seems like there might be a notification popping up. If you wish to disable these notifications, here is an example in Java on how you can achieve that using ChromeDriver:

ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<>();
prefs.put("profile.default_content_setting_values.notifications", 2);
options.setExperimentalOption("prefs", prefs);
driver = new ChromeDriver(options);

Answer №3

It may be past the deadline for this response, but in case others are looking for a solution using Robotframework. Include the following code snippet in your Chrome preferences section.

${CHROMEPREFS}             Create Dictionary  profile.default_content_setting_values.automatic_downloads=${2}
Open Browser    ${URL}      ${BROWSER}      options=add_experimental_option("prefs", ${CHROMEPREFS})

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

Finding the element and extracting its text value

Below is the HTML code: <span> <b>Order number:</b> </span> <span>A36HASJH</span> The value within the span element, A36HASJH, is dynamic and changes with each order. How can I identify this element and store it as a s ...

Automate selecting an option from a dropdown using Python with Selenium

I am encountering an issue while trying to choose an option from The error message I'm receiving is: selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable: Element is not currently visible and may not be manipula ...

Guide on pressing the "Next" button on the Twitter login page with Selenium and Python

Currently, I am working on developing a Twitter automation bot using Selenium. However, I have encountered an error when attempting to log in and click on the next button after entering the user ID. I have experimented with various methods like xpath, lin ...

Ways to determine if a tag is the final one

Utilizing Selenium and Java for writing a test involves working with the following DOM structure: <tbody> <tr> <th>Copy</th> <th>Subfield</th> <th>Subfield Border</th> <th>Field</th& ...

Unable to successfully transmit the driver input within the annotated test method

Here is the code snippet that I am currently using: @AfterMethod() public static void takeSnapShot(WebDriver webdriver, String fileWithPath) throws Exception { // Convert web driver object to TakeScreenshot TakesScreenshot scrShot = ((TakesScreens ...

Steps for creating an ant target that can take in arguments

I am currently using the selenium TestNG framework and in the past, we utilized XML files to start and stop the Selenium grid. However, as the XML files were affecting the test reports, we have opted to remove them and switch to using Ant for this purpose. ...

Python Selenium encounters difficulty in locating elements using Class Name and xpath

I am using Selenium to automate the process of clicking the Download button located in the Historical Data/Time and Sales Historical Data section on this webpage: . This is the code I have tried: sgxMainPageUrl = "https://www.sgx.com/research-educati ...

The Benefits of Using ChromeDriverService in Selenium Automation

The ChromeDriverService class can be found in the org.openqa.selenium.chrome package. It's functionality allows for starting the Chrome driver on any port of the machine using the code snippet below: ChromeDriverService service = new ChromeDriverServ ...

Tips for waiting for a page to load in Selenium using Java

I am currently seeking a method to delay page execution until all elements have been fully updated. An example scenario would be waiting for a screen value to change after clicking a button, thus ensuring that the new value has been displayed. My objectiv ...

Using Selenium with JavaScript and Python to simulate key presses

Is there a way to simulate key presses as if typing on a keyboard? I am looking to programmatically click on an input element and then emulate the user typing by pressing keys. I prefer not to use XPath selectors combined with sendkeys or similar methods. ...

Selenium failing to activate search box

In my project, I am using Selenium to automate the following tasks: Open a website Click on the search box Type "Seattle" in the search box Select the first result from the suggested results Hit Enter Click on a new search box Type "Chicago" in the new se ...

Proposed guidelines for naming Selenium elements

Currently, I am utilizing the Selenium page object model to define all the elements on the page. However, I have some concerns regarding the naming conventions I've used for these elements as they seem overly verbose. Any suggestions for improvement w ...

The current_url loop is getting stuck on various unexpected links

My current challenge involves fetching the URL for webpages that redirect to other URLs when clicked. However, my loop seems to get stuck on random pages without any consistency in which page it happens. There are no errors thrown, and it enters an infinit ...

I'm just starting out with Python and I'm wondering how I can access the initial values for precipitation, temperature, wind gust, and humidity

from selenium import webdriver import time PATH = "C:\Program Files (x86)\chromedriver.exe" driver = webdriver.Chrome(PATH) driver.get("https://www.metoffice.gov.uk/weather/forecast/gcvwr3zrw#?date=2020-07-12") time.sleep(5 ...

Executing the Python Selenium script to interact with an element inside a frame

Encountering a problem on LinkedIn where clicking the "Connect" button brings up a frame like this: https://i.stack.imgur.com/tP1pH.png I am attempting to click the "Send now" button but it is not visible. I have tried switching frames using various id/c ...

Selenium's click() function is functioning properly, however, the submit() function is not working

During my Selinium Webdriver tests, I have encountered a puzzling issue where I am unable to submit a form by using the submit() method on the elements within the form. However, I can successfully submit the form by calling click() on the submit button. To ...

Accessing pop-up windows with the Selenium Robot Framework

I am having trouble accessing a pop-up window using the selenium webdriver in the robot framework. Here are the steps I have taken: Visit the site "" Click on the "Search By Vehicle" tab. A pop-up window opens. I attempted to access the pop-up by usin ...

What is the process for running selenium-webdriver/protractor commands interactively within the command line of Chrome DevTools?

Guide on: creating a test without completion placing a breakpoint at the conclusion of the unfinished test navigating to repl / command line / chrome devtools running Selenium commands in repl / command line / chrome devtools ...

Changing IP addresses in Python

After reading the post on changing IP addresses in Python using Selenium, I realized it didn't provide much help for my current situation. I am working on a test website and attempting to implement an anti-brute force script. My aim is to block an IP ...

Error encountered while trying to utilize the modal input box in the Robot Framework Python script

I developed a Robot Framework code to interact with an input box inside a Modal that opens when a button is clicked. However, upon opening the modal, it displays a message stating that the "input box" is not interactable. It's worth noting that there ...