![](https://learn.microsoft.com/media/logos/logo_edge.png)
Hi @Luc Havelson ,
According to your description, you can try to use add_experimental_option
to achieve your requirements, here is a simple sample code(part of your code):
from msedge.selenium_tools import Edge, EdgeOptions
options = EdgeOptions()
options.use_chromium = True
mobile_emulation = {
"deviceMetrics": { "width": 375, "height": 812, "pixelRatio": 3.0 },
"userAgent" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Mobile Safari/537.36 Edg/92.0.902.78"
}
options.add_experimental_option("mobileEmulation", mobile_emulation)
driver = Edge(executable_path = r"C:\Users\Administrator\Desktop\msedgedriver.exe",options = options)
driver.get('https://www.google.com')
Note: You need to replace the executable_path
according to your own situation, and ensure that the mobile device parameters are correct.
And this is result:
Best regards,
Xudong Peng
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.