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

[dotnet] Fix error when we send non-base64 data for fetch command #12431

Merged
merged 8 commits into from
Jul 31, 2023
Merged

[dotnet] Fix error when we send non-base64 data for fetch command #12431

merged 8 commits into from
Jul 31, 2023

Conversation

nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Jul 27, 2023

Description

I see a lot of exceptions while working with CDP. This PR fixes only one exception.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@nvborisenko
Copy link
Member Author

nvborisenko commented Jul 28, 2023

Win! Now basics scenarios for network requests intercepting works.

Before:

driver.Manage().Network.StartMonitoring().Wait();

driver.Url = "https://google.com";

It throws many exceptions related to "Fetch" cdp domain.

Now we are able even do:

driver.Manage().Network.StartMonitoring().Wait();

net.AddRequestHandler(new NetworkRequestHandler
            {
                RequestMatcher = httpData => httpData.Url.Contains("google.com"),
                RequestTransformer = req =>
                {
                    req.Url = "https://selenium.dev";
                    return req;
                },
            });

driver.Url = "https://google.com"; // it opens selenium.dev instead of google.com

And even changing response body:

net.AddResponseHandler(new NetworkResponseHandler
            {
                ResponseMatcher = httpData => httpData.Url.Contains("google.com"),
                ResponseTransformer = res =>
                {
                    res.Body = "Hello World!";
                    return res;
                },
            });

@diemol diemol added this to the 4.11 milestone Jul 28, 2023
@nvborisenko
Copy link
Member Author

Still facing issue Invalid InterceptionId, but it is absolutely different story.

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @nvborisenko!

@diemol diemol merged commit 316d8cf into SeleniumHQ:trunk Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants