1

I am using Protractor for testing my web application. During the use of the app, I want to press a hard key on the device, like the home screen, then the app will be minimized and I will see the device's home screen. After that, I want to tap again on the app, and I want to see the screen I was before tapping on the home screen key.

  • By any chance, Protractor is able to simulate this action? If not, which tool do you recommend I can integrate with Protractor?
  • Do you think it is a good approach to automate just this touch scenario?

1 Answer 1

1

Protractor supports all webdriverjs keys

https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_Key.html

HOME is one of them , you can use these in protractor using hte "protractor" global function

protractor.key.HOME

and could be used with sendKeys

 element.sendKeys(protractor.key.HOME)

 browser.actions().sendKeys(protractor.Key.HOME).perform();
1
  • Hi @PDHide, I think I was not clear. What I want is not to press the Home key of the laptop for instance, but instead I want to press the home key, recent apps key or return key of the mobile device.
    – IBrito
    Commented Apr 8, 2020 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.