Selenium - mobile emulation (chrome dev tools) not showing touch circle


If this post is not formatted in the best way, please let me know as it is my first post.
I feel it is also important to say that I have been learning both Python and Selenium for less than a month.

I am trying to emulate a mobile device via chrome dev tools, and as far as I know, the “touch” option will default to “true”. Despite this, I have also specified it in the code, yet whenever I hover my mouse over the browser window, the “touch circle” that normally appears when using chrome dev tools “device toolbar”, isn’t present this time.

Here is what the code look like:

from selenium import webdriver
from import Options
from import Service

mobile_emulation = {
“deviceMetrics”: { “width”: 375, “height”: 812, “pixelRatio”: 3.0 },
“userAgent”: “Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19”,
“touch”: “true”

options = Options()
options.add_experimental_option(“mobileEmulation”, mobile_emulation)
driver = webdriver.Chrome(service=Service(“/Users/user1/documents/chromedriver”), options=options)


If possible, it would be great to gain some insight regarding whether the touch feature is activated, and if it is, why it doesn’t show in the way that it does when using the device toolbar normally.

Any help is much appreciated.

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