Having difficulty sending the [ctrl][p] keys to a page that is not using Angular framework

Working with protractor version 5.1.2, Angular 5, and typescript 2.4.2

When attempting to trigger a 'print' function using the shortcut keys '[ctrl][p]' in protractor on a non-angular page, I encountered an issue. Within my protractor script, I transitioned from an angular page to a non-angular page in a new tab. Although I was able to locate the 'embed' tag in the HTML of this page, sending the keys [ctrl][p] did not produce the desired result. The statement I used is as follows:

browser.driver.actions().sendKeys(Key.CONTROL,'p',Key.NULL)

Despite using the syntax referenced in the protractor API documentation, the command did not work as expected.

Any assistance on this matter would be highly appreciated.

Below is a snippet of the script:

await browser.getAllWindowHandles().then(async function (handles) {
    if(handles.length = 1){
        await browser.sleep(2000)
    } 
})
await browser.getAllWindowHandles().then(async function (handles) {
    let reporthandle = handles[1];

    await browser.switchTo().window(reporthandle).then( function(){
        browser.ignoreSynchronization = true;
        browser.driver.actions().sendKeys(protractor.Key.CONTROL, 'p')

Answer №1

  1. browser.ignoreSynchronization has been marked as deprecated. The new method to use is in the protractor config:

    onPrepare() {
      browser.waitForAngularEnabled(false)
    }
    
  2. Have you tried using browser.driver.actions() instead of browser.actions()? Give it a go

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

Ensure to call the typescript file every time the page is reloaded or when a URL change occurs

Looking to integrate a session feature into my Angular 5 application. I aim to create a single TypeScript file that will handle user login validation. Is there a way to trigger this file every time the page reloads or the URL changes? Need guidance on im ...

The interaction between Web API, Angular, and the unique MAC Address

My organization currently operates an Application using ASP MVC. However, the application is experiencing slow performance and confusion due to multiple programmers with conflicting ideas. I have taken on the task of refactoring and migrating it to Angular ...

Encountering an issue with the 'createObjectURL' function in URL, resulting in overload resolution failure when using npm file-saver

While working on my angular app, I encountered a situation where I needed to download user details uploaded as a Word document to my local machine using the angular app. Successfully, I was able to upload and save this data to my database, getting its byte ...

Linking Angular 2 Production Mode to the vendor directory

I am currently working on an Angular2 project using the angular-cli npm package. To upload the app to the server, I used the following commands: ng build --prod and ng serve --prod. However, after uploading the dist folder to the server and trying to acc ...

Tips for filtering data using an array within an object containing arrays

Below is the provided information: userRoom = ['rm1']; data = [{ name: 'building 1', building: [{ room: 'rm1', name: 'Room 1' },{ room: 'rm2', name: ' ...

Expanding the capabilities of generic functions in TypeScript using type variables

When working with generics in TypeScript, it is often beneficial for a function that accepts generically-typed arguments to have knowledge of the type. There exists a standard approach to achieve this using named functions: interface TestInterface<T> ...

formatting the date incorrectly leads to incorrect results

Angular example code snippet: console.log( moment('2013-07-29T00:00:00+00:00').format('YYYY-MM-DD') ); Why is the output of this code showing 2013-07-28 instead of 2013-07-29? I would appreciate some help in understanding what may ...

The devastation caused by typing errors in TypeScript

I have a preference: const settings = { theme: "light", }; and feature: const Feature = ({ setting }: Props) => ( <FeatureBlock> <FeatureValue scale="large" size={20}> {setting.theme} </Styled.FeatureValue> ...

Angular Universal build stuck on rendering page while waiting for API response

I'm currently developing a compact web application using the angular universal starter in combination with pokeapi. To enhance performance and reduce API requests, I intend to implement pre-rendered pages since the data displayed remains mostly static ...

What is the best way to transform an array containing double sets of brackets into a single set of brackets?

Is there a way to change the format of this list [[" ", " ", " ", " ", " ", " ", " ", " ", " ", " "]] to look like [" ", " ", " &qu ...

Ensuring type signatures are maintained when wrapping Vue computed properties and methods within the Vue.extend constructor

Currently, I am trying to encapsulate all of my defined methods and computed properties within a function that tracks their execution time. I aim to keep the IntelliSense predictions intact, which are based on the type signature of Vue.extend({... Howeve ...

Every time I attempt to submit the login form on the Ionic and Angular page, instead of capturing the values of the form group, the page simply refreshes

Struggling with submitting the login form in Ionic and Angular? When attempting to submit, the page reloads instead of capturing the form group values. I am utilizing angular reactive forms and form builder within the ionic framework. Need assistance in id ...

Storing data in Angular 2's ngFor loop for later usage

I have a list of different types created by a for loop. Each type in the list has a delete button next to it, allowing users to remove that specific item. Clicking on the delete button opens a modal where the user can confirm the deletion. To avoid having ...

"Troubleshooting: The Angular Check-All feature is unexpectedly selecting disabled checkboxes within the ngx data

Within ngx-datatable, I have implemented a functionality where some checkboxes are disabled based on certain conditions. However, when I try to select all checkboxes, even the disabled ones get selected. How can this issue be resolved so that disabled chec ...

Enhance your React Highchart by incorporating gradient shading to the data points

One interesting feature in classic highcharts is the ability to apply gradient coloring to points: Highcharts.setOptions({ colors: Highcharts.getOptions().colors.map(function (color) { return { radialGradient: { cx: ...

Retrieve a collection of nested dictionaries containing flask and angular data

In my app development journey with flask and ionic(angular), I'm working on returning a JSON list. Here's the python code snippet: def get-stocks(): # Select all stocks cursor.execute("""SELECT * FROM `tbl_symbol_index`"" ...

Is there a way to activate Apache Proxy Cache for error status responses such as 403 or 404?

We have successfully implemented Apache Web Server (HTTPD) as a proxy for the Angular Universal (SSR) app. The caching functionality is working well when the Angular App responds with a status code of 200, as confirmed by the X-Cache: HIT from <url> ...

Tips for indicating errors in fields that have not been "interacted with" when submitting

My Angular login uses a reactive form: public form = this.fb.group({ email: ['', [Validators.required, Validators.email]], name: ['', [Validators.required]], }); Upon clicking submit, the following actions are performed: ...

Retrieving information from a child component within the parent component

I am facing an issue where I have a list in the child component that I want to access from the parent component (AppComponent). I am trying to display this list using the @ViewChild decorator, but I keep getting undefined for the list in the parent compone ...

How to transfer a value from an observable to a (click) event handler in Angular2

I am currently trying to grasp the concepts of observable programming within Angular 2, but one crucial point eludes me - how can I pass the value from an observable into the (click) event at the template level without subscribing to the observable in the ...