0

I can set custom window size with python, but can detect my desktop resolution anyway. I need to change screenResolution = 1920,1080 availableScreenResolution = 1920,1032 with selenium chrome. Is it possible?

1 Answers1

0

Screen resolution is retrieved from the screen object. If you enter the console and type screen you will see the values and properties.

You can execute javascript to change the obejct's values like this

driver.execute_script(js)
Object.defineProperty(screen, "availHeight", {
    value: 200,
})

The problem is this object refreshes with every change of location so you'd probably need an extension that executes this every time the browser makes a request

EDIT you can use event handlers to trigger it every time you navigate trigger python events driven by selenium controlled browser

dasfacc
  • 148
  • 2
  • 8