How to make chrome mobile emulation open an h5 page with drag ability?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to make chrome mobile emulation open an h5 page with drag ability?

QunXuan Li

Dear All:

When I open an browser and click Ctrl + Shift +I  or F12, then I click "Toggle device toolbar" button or Ctrl + Shift + M. I get following screen.  

Pay attention to the bigger red box. The grey circle is my mouse cursor.  I can drag the page on this mode.

But when I open browser by mobile emulation as following java code, I get a page without drag ability.

Who knows how to make it can be dragged by code? 

System.setProperty("", userPath + sSeperator + "drivers\\chromedriver.exe");

Map<String, Object> mobileEmulation = new HashMap<String, Object>();    

mobileEmulation.put("deviceName", "iPhone X"); 

Map<String, Object> chromeOptions = new HashMap<String, Object>();       

chromeOptions.put("mobileEmulation", mobileEmulation);       

DesiredCapabilities capabilities =;         

capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);   


WebDriver driver=new ChromeDriver(capabilities);  




Thanks a lot !

You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit
For more options, visit