Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
TisuHitam opened this issue Jul 18, 2024 · 5 comments
Labels
question Someone is looking for answers

Comments

@TisuHitam
Copy link

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 mdmintz added the question Someone is looking for answers label Jul 19, 2024
@mdmintz
Copy link
Member

mdmintz commented Jul 19, 2024

If that's possible with SeleniumBase, it would be via the selenium-wire integration.
See #2145 for details.

@mdmintz mdmintz closed this as completed Jul 19, 2024
@TisuHitam
Copy link
Author

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
Copy link
Member

mdmintz commented Jul 19, 2024

Maybe #2316 (comment)

@TisuHitam
Copy link
Author

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.

@odell0111
Copy link

odell0111 commented Dec 17, 2024

You could set up a proxy to intercept and modify the relevant requests. I posted a sample code using mitmproxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Someone is looking for answers
Projects
None yet
Development

No branches or pull requests

3 participants