SlideShare a Scribd company logo
Device Mode & Mobile Emulation
(Responsive and handheld device testing solution)
- Anshul Mehta
Enabling device mode: Method 1
 To access the DevTools, open a web page or web app in Google Chrome
 Press F12 or Select the Chrome menu at the top-right of your browser
window, then select Tools > Developer Tools.
 Or, Right-click on any page element and select Inspect Element.
 Turn on device mode by pressing the Toggle device mode icon as shown in
image . When device mode is enabled, the icon turns blue and the viewport
transforms into a device emulator.
 As shown in above image
 PS. If above mobile toggle icon is not there than check next slide for
alternative method
Enabling device mode : Method 2
 Open DevTools (Menu>View>Developer>Developer Tools – OR – CMD(CTRL)+ALT+I)
 Open DevTools Settings (Click on the Gear icon near the right-hand side of the DevTools
menu bar) As shown in image belowbelow
 Click on the “Overrides” tab
 If you’re using Chrome Canary, stay on the “General” tab and look under the heading
“Appearance”
 Tick the checkbox for “Show ‘Emulation’ view in console drawer”
 Close the settings
 For reference snapshot given below
Using the screen emulator
 To jump-start your debugging process, device mode has a variety of
emulation presets. Quickly emulate a particular device by selecting a
model from the preset dropdown.
Each preset automatically configures device emulation in the following ways:
 Specifies the UA(user agent) string for requests.
 Sets the device resolution and pixel ratio.
 Enables touch emulation (if applicable).
 Emulates mobile scrollbar overlays and meta viewport.
 Auto sizes (boosts) text for pages without a defined viewport.
Emulating Devices
 The Swap dimensions button in
between the Resolution values () will
swap the width and height.
 Shrink to fit ensures the emulated
device screen is completely visible within
your browser window. This setting does
not emulate the device differently.
 Device media queries (e.g. @media only
screen and (min-device-width:768px))
will be enabled according to the values
defined in the Resolution settings.
 You may want to undock DevTools or
dock it to the right while working with
emulated viewport settings.
 Device settings can be configured
independently of a device preset.
Inspecting media queries
 Media queries are an essential part of responsive web design. Device mode
makes media queries readily accessible and easy for you to inspect.
 To view the media query inspector, click the Media queries icon in the upper
left corner of the viewport. The DevTools detect media queries in your
stylesheets and display them as colored bars in the top ruler.
 Media queries are color-coded as follows:
 Blue Line : Queries targeting a maximum width.
 Green Line : Queries targeting widths within a range.
 Orange Line : Queries targeting a minimum width.
Preview styles for media types
 The media query inspector
targets styles intended for
screens. If you want to
preview styles for other media
types, such as print, you can
do so in the media pane of
the emulation drawer.
 Open the DevTools
emulation drawer by clicking
the More overrides icon in
the top right corner of the
browser viewport. Then,
select Media in the
emulation drawer.
Trigger touch events
 The touch screen emulator lets
you accurately test touch events
and sequences as if you were
using a touch-enabled device.
 Enable touch emulation by
selecting the Emulate touch
screen checkbox in the sensors
pane of the emulation drawer.
 When you interact with the
emulated viewport, the cursor
changes into a fingertip-sized
circle and touch events (such
as touchstart, touchmove,
and touchend) fire as they
would on a mobile device.
 To enable support for touch
event emulation:
 Open the Emulation panel in the
DevTools.
 Enable "Emulate touch screen" in
the Sensors pane.
Geolocation Overrides
 When working with HTML5 geolocation support in an
application, it can be useful to debug the output received
when using different values for longitude and latitude. The
DevTools support both overriding position values
for navigator.geolocation and simulating geolocation not
being available via the Sensors pane.
 Overriding geolocation positions
 In the DevTools, open up the Sensors pane within the
Emulation panel.
 Check "Emulate geolocation coordinates" and enter 41.4949819
in the Lat field and -0.1461206 in the Lon field.
 Refresh the page.
Device Orientation Overrides
 Many new mobile devices are now
shipping with accelerometers,
gyroscopes, compasses and other
hardware designed to determine capture
motion and orientation data. Many web
browsers have access to that new
hardware, such as via the HTML5
DeviceOrientation events. These events
provide developers with information
about the orientation, motion and
acceleration of the device.
 If your application is taking advantage of
device orientation events, it can also be
useful to override the values received by
these events during debugging to avoid
the need to test them on a physical
mobile device.
 Overriding orientation values
 Navigate to the Device
Orientation demo and notice the
standard HTML5 logo along with the
current orientation values listed above
it.
 Open the Emulation panel in the
DevTools and click the Sensors pane.
 Check "Accelerometer".
 You will see three fields:
 α: how much the device has been rotated
around the z-axis.
 β: how much the device is tilted left-to-
right.
 γ: how much it's tilted front-to-back.
 Change the values to the following:
 α - 0
 β - 60
 γ - 60
For any queries reach me @ Anshul.Mehta
http://anshulmehta.branded.me/
http://google.com/+AnshulMehta

More Related Content

What's hot

Take a Ride on the Metro
Take a Ride on the MetroTake a Ride on the Metro
Mobile game testing report
Mobile game testing reportMobile game testing report
Mobile game testing report
QA Madness
 
what happens when you inserd each type of media device
 what happens when you inserd each type of media device what happens when you inserd each type of media device
what happens when you inserd each type of media device
Binna Krassniqi
 
Proficy machine edition alarms
Proficy machine edition alarmsProficy machine edition alarms
Proficy machine edition alarms
Iamtubalcain
 
Cutviewer mill user guide v3
Cutviewer mill user guide v3Cutviewer mill user guide v3
Cutviewer mill user guide v3
benjyanim
 
Computer basics
Computer basicsComputer basics
Computer basics
lev12
 
Important information
Important informationImportant information
Important information
Chrissy Arch
 

What's hot (7)

Take a Ride on the Metro
Take a Ride on the MetroTake a Ride on the Metro
Take a Ride on the Metro
 
Mobile game testing report
Mobile game testing reportMobile game testing report
Mobile game testing report
 
what happens when you inserd each type of media device
 what happens when you inserd each type of media device what happens when you inserd each type of media device
what happens when you inserd each type of media device
 
Proficy machine edition alarms
Proficy machine edition alarmsProficy machine edition alarms
Proficy machine edition alarms
 
Cutviewer mill user guide v3
Cutviewer mill user guide v3Cutviewer mill user guide v3
Cutviewer mill user guide v3
 
Computer basics
Computer basicsComputer basics
Computer basics
 
Important information
Important informationImportant information
Important information
 

Similar to Google Chrome DevTools for Mobile Screencast and Emulation

Laboratorio: Desarrollo para Smart Devices (continuación)
Laboratorio: Desarrollo para Smart Devices (continuación)Laboratorio: Desarrollo para Smart Devices (continuación)
Laboratorio: Desarrollo para Smart Devices (continuación)
GeneXus
 
Laboratorio: Desarrollo para Smart Devices
Laboratorio: Desarrollo para Smart DevicesLaboratorio: Desarrollo para Smart Devices
Laboratorio: Desarrollo para Smart Devices
GeneXus
 
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docxopensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
hopeaustin33688
 
Work spaceconnect 2.0 user guide
Work spaceconnect 2.0 user guideWork spaceconnect 2.0 user guide
Work spaceconnect 2.0 user guide
William McIntosh
 
Work spaceconnect 2.0 user guide
Work spaceconnect 2.0 user guideWork spaceconnect 2.0 user guide
Work spaceconnect 2.0 user guide
William McIntosh
 
Guide To Magic Infoforuser
Guide To Magic InfoforuserGuide To Magic Infoforuser
Guide To Magic Infoforuser
Palm Beach Atlantic University
 
Lesson 13 Using Accessibility Wizard
Lesson 13   Using Accessibility WizardLesson 13   Using Accessibility Wizard
Lesson 13 Using Accessibility Wizard
guevarra_2000
 
Android software development – the first few hours
Android software development – the first few hoursAndroid software development – the first few hours
Android software development – the first few hours
sjmarsh
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
Palakjaiswal43
 
Remove maps galaxy toolbar – uninstall tutorial
Remove maps galaxy toolbar – uninstall tutorialRemove maps galaxy toolbar – uninstall tutorial
Remove maps galaxy toolbar – uninstall tutorial
webpub
 
Distimo monitor
Distimo monitorDistimo monitor
Distimo monitor
Vallari_Mehta
 
window_10_user_guide.pdf
window_10_user_guide.pdfwindow_10_user_guide.pdf
window_10_user_guide.pdf
Mertin2
 
Windowstechnicalpreviewqg
WindowstechnicalpreviewqgWindowstechnicalpreviewqg
Windowstechnicalpreviewqg
Alex Carranza
 
Windows 10 Technical Preview - http://f2suporte.blogspot.com
Windows 10 Technical Preview - http://f2suporte.blogspot.comWindows 10 Technical Preview - http://f2suporte.blogspot.com
Windows 10 Technical Preview - http://f2suporte.blogspot.com
Wlademir RS
 
Session 2
Session 2Session 2
GuideMaker Design Customization Guideline
GuideMaker Design Customization GuidelineGuideMaker Design Customization Guideline
GuideMaker Design Customization Guideline
iLandGuide Worldwide Inc.
 
Javagoodbook
JavagoodbookJavagoodbook
Javagoodbook
Arunachalam V
 
visualAI Inspections Guide
visualAI Inspections GuidevisualAI Inspections Guide
visualAI Inspections Guide
Jaspreet Singh
 
spec
specspec
Milestone 4 pptx-- responsive prototype
Milestone 4 pptx-- responsive prototypeMilestone 4 pptx-- responsive prototype
Milestone 4 pptx-- responsive prototype
Matt Craig
 

Similar to Google Chrome DevTools for Mobile Screencast and Emulation (20)

Laboratorio: Desarrollo para Smart Devices (continuación)
Laboratorio: Desarrollo para Smart Devices (continuación)Laboratorio: Desarrollo para Smart Devices (continuación)
Laboratorio: Desarrollo para Smart Devices (continuación)
 
Laboratorio: Desarrollo para Smart Devices
Laboratorio: Desarrollo para Smart DevicesLaboratorio: Desarrollo para Smart Devices
Laboratorio: Desarrollo para Smart Devices
 
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docxopensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
opensteerdocimagesbeta_250a.gifopensteerdocimagesbeta_.docx
 
Work spaceconnect 2.0 user guide
Work spaceconnect 2.0 user guideWork spaceconnect 2.0 user guide
Work spaceconnect 2.0 user guide
 
Work spaceconnect 2.0 user guide
Work spaceconnect 2.0 user guideWork spaceconnect 2.0 user guide
Work spaceconnect 2.0 user guide
 
Guide To Magic Infoforuser
Guide To Magic InfoforuserGuide To Magic Infoforuser
Guide To Magic Infoforuser
 
Lesson 13 Using Accessibility Wizard
Lesson 13   Using Accessibility WizardLesson 13   Using Accessibility Wizard
Lesson 13 Using Accessibility Wizard
 
Android software development – the first few hours
Android software development – the first few hoursAndroid software development – the first few hours
Android software development – the first few hours
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
 
Remove maps galaxy toolbar – uninstall tutorial
Remove maps galaxy toolbar – uninstall tutorialRemove maps galaxy toolbar – uninstall tutorial
Remove maps galaxy toolbar – uninstall tutorial
 
Distimo monitor
Distimo monitorDistimo monitor
Distimo monitor
 
window_10_user_guide.pdf
window_10_user_guide.pdfwindow_10_user_guide.pdf
window_10_user_guide.pdf
 
Windowstechnicalpreviewqg
WindowstechnicalpreviewqgWindowstechnicalpreviewqg
Windowstechnicalpreviewqg
 
Windows 10 Technical Preview - http://f2suporte.blogspot.com
Windows 10 Technical Preview - http://f2suporte.blogspot.comWindows 10 Technical Preview - http://f2suporte.blogspot.com
Windows 10 Technical Preview - http://f2suporte.blogspot.com
 
Session 2
Session 2Session 2
Session 2
 
GuideMaker Design Customization Guideline
GuideMaker Design Customization GuidelineGuideMaker Design Customization Guideline
GuideMaker Design Customization Guideline
 
Javagoodbook
JavagoodbookJavagoodbook
Javagoodbook
 
visualAI Inspections Guide
visualAI Inspections GuidevisualAI Inspections Guide
visualAI Inspections Guide
 
spec
specspec
spec
 
Milestone 4 pptx-- responsive prototype
Milestone 4 pptx-- responsive prototypeMilestone 4 pptx-- responsive prototype
Milestone 4 pptx-- responsive prototype
 

Google Chrome DevTools for Mobile Screencast and Emulation

  • 1. Device Mode & Mobile Emulation (Responsive and handheld device testing solution) - Anshul Mehta
  • 2. Enabling device mode: Method 1  To access the DevTools, open a web page or web app in Google Chrome  Press F12 or Select the Chrome menu at the top-right of your browser window, then select Tools > Developer Tools.  Or, Right-click on any page element and select Inspect Element.  Turn on device mode by pressing the Toggle device mode icon as shown in image . When device mode is enabled, the icon turns blue and the viewport transforms into a device emulator.  As shown in above image  PS. If above mobile toggle icon is not there than check next slide for alternative method
  • 3. Enabling device mode : Method 2  Open DevTools (Menu>View>Developer>Developer Tools – OR – CMD(CTRL)+ALT+I)  Open DevTools Settings (Click on the Gear icon near the right-hand side of the DevTools menu bar) As shown in image belowbelow  Click on the “Overrides” tab  If you’re using Chrome Canary, stay on the “General” tab and look under the heading “Appearance”  Tick the checkbox for “Show ‘Emulation’ view in console drawer”  Close the settings  For reference snapshot given below
  • 4. Using the screen emulator  To jump-start your debugging process, device mode has a variety of emulation presets. Quickly emulate a particular device by selecting a model from the preset dropdown. Each preset automatically configures device emulation in the following ways:  Specifies the UA(user agent) string for requests.  Sets the device resolution and pixel ratio.  Enables touch emulation (if applicable).  Emulates mobile scrollbar overlays and meta viewport.  Auto sizes (boosts) text for pages without a defined viewport.
  • 5. Emulating Devices  The Swap dimensions button in between the Resolution values () will swap the width and height.  Shrink to fit ensures the emulated device screen is completely visible within your browser window. This setting does not emulate the device differently.  Device media queries (e.g. @media only screen and (min-device-width:768px)) will be enabled according to the values defined in the Resolution settings.  You may want to undock DevTools or dock it to the right while working with emulated viewport settings.  Device settings can be configured independently of a device preset.
  • 6. Inspecting media queries  Media queries are an essential part of responsive web design. Device mode makes media queries readily accessible and easy for you to inspect.  To view the media query inspector, click the Media queries icon in the upper left corner of the viewport. The DevTools detect media queries in your stylesheets and display them as colored bars in the top ruler.  Media queries are color-coded as follows:  Blue Line : Queries targeting a maximum width.  Green Line : Queries targeting widths within a range.  Orange Line : Queries targeting a minimum width.
  • 7. Preview styles for media types  The media query inspector targets styles intended for screens. If you want to preview styles for other media types, such as print, you can do so in the media pane of the emulation drawer.  Open the DevTools emulation drawer by clicking the More overrides icon in the top right corner of the browser viewport. Then, select Media in the emulation drawer.
  • 8. Trigger touch events  The touch screen emulator lets you accurately test touch events and sequences as if you were using a touch-enabled device.  Enable touch emulation by selecting the Emulate touch screen checkbox in the sensors pane of the emulation drawer.  When you interact with the emulated viewport, the cursor changes into a fingertip-sized circle and touch events (such as touchstart, touchmove, and touchend) fire as they would on a mobile device.  To enable support for touch event emulation:  Open the Emulation panel in the DevTools.  Enable "Emulate touch screen" in the Sensors pane.
  • 9. Geolocation Overrides  When working with HTML5 geolocation support in an application, it can be useful to debug the output received when using different values for longitude and latitude. The DevTools support both overriding position values for navigator.geolocation and simulating geolocation not being available via the Sensors pane.  Overriding geolocation positions  In the DevTools, open up the Sensors pane within the Emulation panel.  Check "Emulate geolocation coordinates" and enter 41.4949819 in the Lat field and -0.1461206 in the Lon field.  Refresh the page.
  • 10. Device Orientation Overrides  Many new mobile devices are now shipping with accelerometers, gyroscopes, compasses and other hardware designed to determine capture motion and orientation data. Many web browsers have access to that new hardware, such as via the HTML5 DeviceOrientation events. These events provide developers with information about the orientation, motion and acceleration of the device.  If your application is taking advantage of device orientation events, it can also be useful to override the values received by these events during debugging to avoid the need to test them on a physical mobile device.  Overriding orientation values  Navigate to the Device Orientation demo and notice the standard HTML5 logo along with the current orientation values listed above it.  Open the Emulation panel in the DevTools and click the Sensors pane.  Check "Accelerometer".  You will see three fields:  α: how much the device has been rotated around the z-axis.  β: how much the device is tilted left-to- right.  γ: how much it's tilted front-to-back.  Change the values to the following:  α - 0  β - 60  γ - 60
  • 11. For any queries reach me @ Anshul.Mehta http://anshulmehta.branded.me/ http://google.com/+AnshulMehta

Editor's Notes

  1. DevTools contains built in presets for a number of devices, this allows you to emulate and debug mobile viewport issues like CSS media query breakpoints. Selecting a device preset automatically enables a number of settings: User agent - a string available at navigator.userAgent and also sent as a request header for page resources. See Useragent Spoofing. Screen resolution - matches the actual dimensions (width and height) of the selected device. For example, selecting the Nexus S will emulate a resolution of 480x800. Device Pixel Ratio - matches the DPR of the selected device. Allows emulation of a retina device from a non-retina machine. This also means media queries such as @media only screen and (min-device-pixel-ratio: 2) can be tested. Emulate viewport - zooms the page out to the physical default viewport of that device. In the case of the Nexus 4 this is 768x1280. Text autosizing - emulate font boosting which occurs on mobile devices. Android font metrics - Android artificially increases the font metrics used by text autosizing based on the system settings and screen size. Enabled by default only when emulating an Android device. Touch screen (part of the Sensors pane) - uses touch events, see Emulating Touch Events.
  2. NOTES Feature detects such as Modernizr.touch will now succeed on page refresh. This feature, like many other overrides, will only work while the DevTools are open. The cursor will change to a small circle to emulate a fingertip size. Use Shift + Drag to emulate a "pinch". Enabling "Emulate touch screen" does not disable mouse events entirely, as they are fired on touch devices. Try this touch event listener test page, touch is another option we can debug with. On click, the order of events fired is currently: touchstart > mousedown > touchmove > touchend > mouseup > click. On touch devices, this order is slightly different. The tools will shortly be updated with the right order. elem.ontouch* handlers will currently not fire with this feature. Use the --touch-events command line flag to let Chrome trigger these handlers.