Error in Protractor: Headless Chrome fails to download file

Having trouble downloading a file using Protractor with Headless Chrome. The download works fine when not in headless mode.

In my protractor.conf.js file, I have the following capabilities configured:

capabilities: {
'browserName': 'chrome',
'chromeOptions': {
  'args': ['no-sandbox', 'disable-setuid-sandbox', 'headless'],
  'prefs': {
    'download': {
      'prompt_for_download': false,
      'default_directory': '/tmp'
    }
  }
}

I am attempting to download the file by clicking a button in the UI. Any tips on how to make headless file downloads work, or should I provide more details?

Answer №1

It seems like there is a glitch with the chromium browser. Some solutions can be found here, but unfortunately, none of them are specifically for typescript.

Answer №2

Here is a configuration that I find effective:

chromeOptions: {
  'args': [
    '--headless',
    '--disable-gpu',
    '--test-type=browser',
    '--disable-extensions',
    '--no-sandbox',
    '--disable-infobars',
    '--window-size=1920,1080',
    //'--start-maximized'
     "--disable-gpu",
  ],
    prefs: {    
        'download.default_directory': 'C:\\downloads',
        'download.prompt_for_download':false,
        'download.directory_upgrade':true,
        "safebrowsing.enabled":false,
        "safebrowsing.disable_download_protection":true
      },
},

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

Issue with applying value changes in Timeout on Angular Material components

I'm currently experimenting with Angular, and I seem to be struggling with displaying a fake progress bar using the "angular/material/progress-bar" component. (https://material.angular.io/components/progress-bar/) In my "app.component.html", I have m ...

What steps can be taken to ensure that typescript exports remain backward compatible with module.exports?

I initially defined a node.js module in the following way: function sayHello(){ // do something } module.exports = sayHello; After transitioning to typescript, I created sayHello.ts like this: function sayHello():void { // do something } export de ...

Performing an action within the Redux RTK API Slice

Is it feasible to trigger an action from a different reducer within the API Slice of Redux RTK? Let's say I have this scenario: getSomething: builder.query<SomeProps, void>({ query: () => ({ url: "...", ...

Error code 422 (Unprocessable Entity) is returned by Ionic 2 when making a POST request

After testing my API in Postman, I found that it works fine with the following data: URL: http://{URL}/password/email Method: POST Header: [{"key":"Accept","value":"application/json","description":""} ,{"key":"Content-Type","value":"application/x-www-fo ...

Avoid installing @types typings in dependencies

Can I prevent global typings from being included in installed dependencies? I recently installed a local dependency, which led to the node_modules folder of that dependency being copied over. Within this node_modules folder are @types typings that clash w ...

What is the best way to make the SPA load with the tab displaying the highest value?

I have a React single-page application using Typescript and Material UI. One challenge I'm facing is creating a tab menu with the current month and all previous months, where the last month should be active when the page loads. Despite researching on ...

Looking to retrieve the AssetLoadedFunc properties in the LoadAssets function? Wondering if you should use TypeScript or JavaScript

When I invoke this.AssetLoadedFunc within the function LoadAssets(callback, user_data) LoadAssets(callback, user_data) { this.glg.LoadWidgetFromURL("assets/Js/scrollbar_h.g", null, this.AssetLoaded, { name: "scrollb ...

What causes the session storage to be accessed across various browser sessions?

Scenario While working on an application, I discovered an intriguing behavior in Chrome 62 on Windows 10 related to defining values in sessionStorage. Surprisingly, changing a value in one tab affected other tabs that shared the same key. Initially, I b ...

Which one should you choose for NodeJS: Promise or Callback?

When it comes to writing node functions, I have come across 2 different approaches - using promise or callback. The first method involves defining the findByEmail function as follows: class Users{ static async findByEmail(email: any ) : Promise<Users ...

Is it possible for me to incorporate a new feature into a library that operates using its unique interface?

I'm currently utilizing the angular-gridster2 library and I am looking to add two additional properties in the gridsterItem interface to hold some specific values. How can this be achieved? Despite creating an extended interface of their own, the pack ...

Tips on passing an object as data through Angular router navigation:

I currently have a similar route set up: this.router.navigate(["/menu/extra-hour/extra-hours/observations/", id]) The navigation is working fine, but I would like to pass the entire data object to the screen in order to render it using the route. How can ...

Utilizing Typescript to extract data from a database according to the input provided by the user

Trying to fetch data from Database based on user input. Below is a snapshot of the DB for reference. https://i.sstatic.net/iMRup.png In my frontend, I have a dropdown that displays names from the database. Upon selection, I need to retrieve the correspon ...

Formik: Customizing form rendering based on sibling form values

<ParentComponent> ... <Formik initialValues={getInitialValues(data)} enableReinitialize={true} validationSchema={schema} isInitialValid={!isNew} onSubmit={() => {}} render={formikProps => ( <SimulatorForm&g ...

Leveraging ngOnChanges to determine the display of an overlay based on input alterations

Working with TS/Angular on a web application, I made the decision to refactor some code that handles displaying different overlays. Instead of having separate code for each overlay, I consolidated them into one "master overlay" and created a function withi ...

What steps should I take to resolve the ChunkLoadError related to signalr?

Recently, I encountered an issue while running my nx site locally. It seems that any federated app using signalR is now throwing a ChunkLoadError. I attempted various solutions such as changing the version of signalR, reloading the page, clearing cache, a ...

Encountering issues with vite build due to @types/react-router-dom package

I ran into an issue while developing my react app using Vite and TypeScript. Everything works fine when using Vite for development, but as soon as I switch to "tsc && vite build", I encounter numerous errors from @types/react-router-dom and @types/react-ro ...

Error encountered in EBS Node.js 14: TS5033 - Unable to save file due to EACCES error related to permission denial

Upon creating a new EBS environment with Node.js 14 to replace the deprecated old one, I encountered the following error: Jul 27 22:34:53 ip-172-31-42-207 web: error TS5033: Could not write file '/var/app/current/build/server/validation.js.map': ...

Eliminate the eslint@typescript-eslint/no-unused-vars error in TypeScript when the index parameter is not utilized within a map function

Here's the code snippet in question: const reducer = (element:number, index: number) => [element]; //eslint-message. const positionsArray = $.map(this.positions, reducer); I am converting a Float32Array (this.positions) to a JavaScript array. The ...

Angular 2: Firebase fails to provide a response

I am facing an issue with retrieving data from my Firebase using Angular 2 and TypeScript. While console.log() works, I am unable to return the value into a variable. My DataService looks like this: import {Injectable} from "angular2/core"; import ' ...

Getting event properties in a React component using the rest operator: A comprehensive guide

Can someone please assist me? I am new to TypeScript and struggling with how to use event props in my component. I have defined two props and need all my events as rest props. I encountered an error when trying to use my component with onClick event. The ...