seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
5k stars 942 forks source link

DeviceMetrics wrong required type #2985

Closed tkozybski closed 1 month ago

tkozybski commented 1 month ago

Currently, device metrics require int for pixelRatio, but any number is actually correct (int or float). If you try to pass float to seleniumbase, it will use default settings instead. Many mobile devices use fractional scaling, also any high resolution PC uses a scaling factor.

See: https://developer.chrome.com/docs/chromedriver/mobile-emulation and https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride

mdmintz commented 1 month ago

Thanks for reporting this. It'll be fixed in the next release.

mdmintz commented 1 month ago

This was resolved in 4.29.5 - https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.29.5

tkozybski commented 1 month ago

I'm not sure if width and height can use floats. According to the documentation, only pixel ratio uses number type.

mdmintz commented 1 month ago

This was resolved fully in 4.29.6 - https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.29.6