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

Regression on input[type=file] #52

Open
mathisspark912 opened this issue Oct 28, 2024 · 4 comments
Open

Regression on input[type=file] #52

mathisspark912 opened this issue Oct 28, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@mathisspark912
Copy link

Describe the bug:

This existing code was working using Playwright or undetected_browser :

    upload_button = page.query_selector('input[type="file"]')
    upload_button.set_input_files(pdf_path)

Using Camoufox() raises now an exception, like if Camoufox() was changing the default behavior of Playwright and especially the way input[type=file] are managed.

The exception is ::

ElementHandle.set_input_files: Protocol error (Page.describeNode): error in channel "content::10/16/4": exception while running method "describeNode" in namespace "page": frame.domWindow() is undefined _describeNode@chrome://juggler/content/content/PageAgent.js:418:30
_onMessageInternal@chrome://juggler/content/SimpleChannel.js:237:37
_onMessage@chrome://juggler/content/SimpleChannel.js:194:12
bindToActor/actor.receiveMessage@chrome://juggler/content/SimpleChannel.js:39:44

Version:

Pip package: v0.3.2
Camoufox: v130.0.1-beta.13 (Up to date!)

@mathisspark912 mathisspark912 added the bug Something isn't working label Oct 28, 2024
@daijro
Copy link
Owner

daijro commented Oct 28, 2024

Thanks for reporting. The root issue is related to #48 👍:

In Camoufox, all of Playwright's JavaScript runs in an isolated context. This prevents Playwright from running JavaScript that writes to the main world/context of the page.

While this is helpful with preventing detection of the Playwright page agent, it causes some issues with native Playwright functions like setting file inputs, executing JavaScript, adding page init scripts, etc. These features might need to be implemented separately.

@mathisspark912
Copy link
Author

Ok but what do you mean by implemented separately ?

That you need to implement them in future version of your lib ?

Or during my test case i need to instanciate a regular Playwright object to do what Camoufox does not manage to do ?

@daijro
Copy link
Owner

daijro commented Oct 28, 2024

Ok but what do you mean by implemented separately ?

That you need to implement them in future version of your lib ?

Or during my test case i need to instanciate a regular Playwright object to do what Camoufox does not manage to do ?

I'll need to implement them in a future version of Camoufox to support it.

At the moment, it's not possible to set file inputs in the browser through Playwright or the Camoufox library.

@mathisspark912
Copy link
Author

Or if it is easier to implement, maybe a feature to temporarily disable isloation then reactivate it (i do not know if this make sense on a technical point of view, i did not studied your source code and i am not an expert on browser like implementation).

But for sure, for people not simply using your solution for web scraping but running automated scenarios, filling forms, uploading files or even executing javascript natively with playwright, we need a way to run JS, otherwise it will not be possible to use your solution in production in the future.

This is the only limitation i found on the moment, i tested your solution on specific websites where other open source or even commercial anti-detect browsers failed and your solution gives better results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants