Can you do this? Python

Joined
Apr 10, 2018
Messages
868
Reaction score
193
So i want to Spoof Screen Resolution (Not browser Widht & Height) but cant do it, the only way i found is to change the windows native resolution

http://whatismyscreenresolution.net/
 
Yes, with pyvirtualdisplay for example.
 
Really simple. I'm guessing you want to do it with selenium/requests?

In that case, google: "selenium + screen resolution spoof"
 
Really simple. I'm guessing you want to do it with selenium/requests?

In that case, google: "selenium + screen resolution spoof"

Cant find anything, im not talking about browser window, im talking bout screen resolution

Provide more information.
What are using/doing? Selenium? What browser?


No, you can't do it in Python, you'd have to load the userscript but even that will not work if CSS is used to determine the screen size like what https://ip-check.info does.

ChromeDriver
 
Cant find anything, im not talking about browser window, im talking bout screen resolution



ChromeDriver
ChromeDriver = Selenium mate?

And a browser can't define your screen resolution, just your browser size (unless fullscreen).

This browser size you can define in ChromeDriver settings.
 
ChromeDriver = Selenium mate?

And a browser can't define your screen resolution, just your browser size (unless fullscreen).

This browser size you can define in ChromeDriver settings.

Bro did you even check what website i shared? Yes they can define your screen resolution regardless browser size
 
So i want to Spoof Screen Resolution (Not browser Widht & Height) but cant do it, the only way i found is to change the windows native resolution

http://whatismyscreenresolution.net/
Do you want to do something like Shift+Ctrl+M in Chrome?
 
Looks like it's checking for "screen.height" and "screen.width" so you should be able to just inject some js before the page loads and modify those 2 values.
 
OP, you got solution in first reply in this thread. Let me spoonfeed you:
Code:
from selenium import webdriver
from pyvirtualdisplay import Display


class Pepemakingmony:
    def bhw(self):
        self.display = Display(visible=1, size=(800, 600))
        self.display.start()
        self.driver = webdriver.Firefox(executable_path="/python/geckodriver",)
        self.driver.get('http://whatismyscreenresolution.net/')


Pepemakingmony().bhw()
 
Looks like it's checking for "screen.height" and "screen.width" so you should be able to just inject some js before the page loads and modify those 2 values.
AFAIK Chrome does not allow to inject before JS loads.
A complicated but viable way to do it would be to inject the JS using a MITM proxy or to use Firefox.

you could have saved your self a lot of time if you've just googled it
https://stackoverflow.com/questions/55012755/how-to-set-window-size-in-selenium-chrome-python
It won't work on non headless Chrome, the website checks for availWidth and availHeight which are not window size dependent.
It works on headless Chrome though.

OP, you got solution in first reply in this thread. Let me spoonfeed you:
-snip-
Good solution.
 
OP, you got solution in first reply in this thread. Let me spoonfeed you:
Code:
from selenium import webdriver
from pyvirtualdisplay import Display


class Pepemakingmony:
    def bhw(self):
        self.display = Display(visible=1, size=(800, 600))
        self.display.start()
        self.driver = webdriver.Firefox(executable_path="/python/geckodriver",)
        self.driver.get('http://whatismyscreenresolution.net/')


Pepemakingmony().bhw()

Thank you for the help, i think pyvirtualdisplay does not work on windows, will try on linux and see !
 
Do you do anything for the getrectangle fingerprint ?
 
Back
Top