Selenium | How to emulate mobile device

Hello.

I was wondering if anyone can help me with setting up my Webdriver, so I can emulate a mobile device experience. I have been seeing how to do it through Selenium but not through the Selenium nodes in KNIME. Any guidance would be appreciated. Thank you so much!

Hi dashwoodhouse,

can you give some more details about what parts of a mobile experience would you want to address exactly and what your use case is?

Thanks,
Philipp

Hello, Philipp!

I would like to emulate viewing a website on mobile mode. I would like to see the website’s mobile mode appearance and screenshot it. Thank you!

Understood, thanks for clarifying.

You can use Chrome/Chromium’s mobileEmuation property to specify details about the mobile device which you want to simulate. You will need to configure the capabilities structure in Start WebDriver or WebDriver Factory as follows (note to use the proper structure and types – sorry in advance, the capabilities editor is not very user friendly :blush: ):

The property names should be self-explanatory. You can typically google the specs for width, height, and pixelRatio if you search for like “iPhone mini screen size pixel ratio”. The userAgent depends on the browser and version which you’d like to simulate. Anyways, if you’ve been doing this with plain Selenium, this should be clear :slight_smile:

I will include a ready-made example snippet for this in one of the next Selenium Nodes versions.

Hope this helps!

-Philipp

[update] Mini example workflow here on the Space: Selenium_Mobile_43465 — NodePit

5 Likes

Thank you so much, Philipp! This was exactly what I was looking for. I know that there was mobileEmulation and all these capabilities, but I couldn’t figure out how to put them in the Capabilities editor. Thank you again for all the help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.