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 Answer
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
1 Comment
dasfacc
Ok no this doesn't work, but maybe a step in the right direction
driver.set_window_size(1366,768)andoptions.add_argument("--window-size=1366,768")tried both