What are valid deviceNames for Chrome emulation te

2019-03-16 15:29发布

问题:

The common web consensus seems to be that if you see a name in your chrome emulator, you can use it as-is in your protractor config ... so I tried Apple iPad:

    {
      browserName: 'chrome',
      chromeOptions: {
        mobileEmulation: {
          deviceName: 'Apple iPad'
        }
      }
    }

But I had to muck around until trial & error yielded the correct deviceName to be: Apple iPad 3 / 4

Now I've searched here: https://developer.chrome.com/devtools/docs/device-mode#enable-device-mode and here: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation but I can't find a list of all the valid deviceNames. Any ideas where to get it?

On https://code.google.com/p/chromium/codesearch I found: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json&q=%22Apple%20iPad%22&sq=package:chromium&type=cs&l=643

But that's not really the source code that matters.

Maybe the source code for chrome webdriver somewhere else may have an enumerated list but I couldn't find it, any help is appreciated!

回答1:

So I found some sources but they seemed to referencing links that didn't exist anymore. This seems to be the best result I could find?

https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/devtools/front_end/emulation/OverridesUI.js&l=338

EDIT: This list seems like the master list https://code.google.com/p/chromium/codesearch#chromium/src/chrome/test/chromedriver/chrome/mobile_device_list.cc



回答2:

This code contains supported devices:

https://cs.chromium.org/chromium/src/chrome/test/chromedriver/chrome/mobile_device_list.cc?type=cs&q=%22Apple+iPhone+6%22&sq=package:chromium&l=12

For the moment it contains:

Laptop with touch
BlackBerry Z30
Google Nexus 6
Google Nexus 7
Google Nexus 4
Google Nexus 5
Apple iPad
Laptop with HiDPI screen
Samsung Galaxy Note II
Nokia N9
Samsung Galaxy S4
Nokia Lumia 520
BlackBerry PlayBook
Apple iPhone 5
Apple iPhone 4
Apple iPhone 6
LG Optimus L70
Apple iPhone 6 Plus
Apple iPad Mini
Amazon Kindle Fire HDX
Samsung Galaxy S III
Laptop with MDPI screen
Samsung Galaxy Note 3
Google Nexus 10