4

I work on a very big project that has Unit tests, integration tests and selenium tests.

We use the selenium tests to test a webapp frontend in Chrome, Firefox and Edge. But one of the frameworks we use has a controller that doesn't work correctly on a touchscreen (you can use the touchscreen to click the controller but not use the mouse).

Recently some of our clients started to use touchscreen computers and laptops, so I would like to have my selenium tests run like they would be run on a touchscreen.

We have a Windows server for the selenium tests. This server doesn't have a screen.

How can I run Selenium Tests as if they were run on a touchscreen device?

4

Selenium provides some touch interaction methods like singleTap, doubleTap, longPress, flick, scroll etc.

Example: for doing single tap on an element -

new TouchActions(driver).singleTap(element).perform();

See the documentation of TouchActions class for details.

| improve this answer | |
  • Good answer. There would also be useful to give some advice on the possible (ideally painless) ways to migrate existing tests from click() to touch. – Alexey R. Apr 24 '18 at 11:25
  • 1
    So I would have to rewrite all my tests for this? – Jungkook Apr 24 '18 at 11:46
3

Shahid's answer mentions new actions.

Hard part is how to make the conversion of existing tests as painless as possible, preferably automatic, and able to run on both types of devices from single codebase.

We use custom thin wrapper around selenium calls (no raw calls) in our pageobjects. So it will be easy for us to add different action (singleTap() vs click() ) to those wrappers.

If you used raw Selenium calls, this would be good time to add the wrapper.

| improve this answer | |
-1

Selenium doesn't handle that part, I suggest you look at Appium for mobile devices - it handles more then just mobile.

https://appium.io/docs/en/drivers/windows/

Appium has the ability to automate Windows PC Desktop apps. This driver relies on a project from Microsoft called WinAppDriver, which is an Appium-compatible WebDriver server for Windows Desktop apps (and more in the future). WinAppDriver is often abbreviated "WAD". WAD is bundled with Appium and does not need to be installed separately.

The Windows Driver supports testing of Universal Windows Platform (UWP) and Classic Windows (Win32) applications.

Mac at https://appium.io/docs/en/drivers/mac/

| improve this answer | |
  • I need Selenium tests for computer and laptop, not mobile devices – Jungkook Apr 24 '18 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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