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')