Repository navigation
Conversation
|
it would be better to add a Literal check for the browser with Update: ok, I don't like the idea of leaving this commit with an arbitrary getattr, so I added a tuple check for now |
|
Hello @sherpya and thanks for the contribution! We should have time to review it next week. |
vdusek
left a comment
There was a problem hiding this comment.
Seems good, thanks! Could you please also add a test covering launch_persistent_context case?
|
Hi, I can make requested changes, perhaps I have no idea how to make a test for a similiar feature, do I just need to see if the call work? Or I may check if somehow the profile is created in the given directory |
The bare minimum would be to just run it and make sure it doesn't crash 🙂 But if you could make a profile directory somewhere and find a way to check that it is actually being used by the headless browser, that would be awesome! |
|
Hi, I've got a problem, launch with profile returns a I've updated the PR but commented out the is_connected check for now |
if user_data_dir option is found in browser_option, then the launch function used is launch_persistent_context instead of launch and the user_data_dir option is passed to playwright
|
I've tried with something like (also with assignment), (not proud of): if isinstance(browser, BrowserContext):
setattr(browser, 'is_connected', lambda: not browser._impl_obj._close_was_called) # noqa: SLF001, B010but mypy says: assert not browser_controller.is_browser_connectedis unreachable I think it should be implemented upstream, but profile dir support would be very nice to have before (in some way) |
|
The fact that launch_persistent_context returns a BrowserContext while the launch returns a Browser is a problem and our current abstraction is not designed to handle this difference. Addressing it would require deeper intervention into it, which I'm hesitant about. Isn't there a way to extract a |
|
I'll close for now, I will open a new PR if I get a decent way to implement it |
if user_data_dir option is found in browser_option, then the launch function used is launch_persistent_context instead of launch and the user_data_dir option is passed to playwright
Description
it makes possible to use custom user provided profile directory with playwright
without changing the api
Issues
Testing
Checklist