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

How to Modify Response Body in SeleniumBase Similar to Playwright's `page.route`? #2935

Closed TisuHitam closed 1 month ago

TisuHitam commented 1 month ago

Hi,

I have a question regarding SeleniumBase. Is it possible to modify the response body in SeleniumBase similar to how it can be done in Playwright using page.route? If this feature is not directly available, is there an alternative method or solution for achieving this?

Thank you!

mdmintz commented 1 month ago

If that's possible with SeleniumBase, it would be via the selenium-wire integration. See https://github.com/seleniumbase/SeleniumBase/issues/2145 for details.

TisuHitam commented 1 month ago

I understand that selenium-wire integration is the way to go. However, I need to use uc mode, and as far as I know, wire mode doesn't work with uc mode. Is there any other workaround or solution that allows modifying the response body while still using uc mode?

mdmintz commented 1 month ago

Maybe https://github.com/seleniumbase/SeleniumBase/issues/2316#issuecomment-1827067375

TisuHitam commented 1 month ago

Thanks for the suggestion, but driver.execute_cdp_cmd didn’t work. If there’s no other solution, I guess I’ll have to go without it.