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

Add a method for chromium-attached browser_key #116

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

illgitthat
Copy link

Work in progress, sharing this in case anyone sees what I am missing.

browser_context = await browser.new_context(**browser_args)

browser_artifacts = BrowserContextFactory.build_browser_artifacts(har_path=browser_args["record_har_path"])
return browser_context, browser_artifacts
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the error you get trying this out??

Copy link
Contributor

Choose a reason for hiding this comment

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

This code generally looks correct to me (minus the if contexts part)

Copy link
Author

Choose a reason for hiding this comment

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

Resharing here:

2024-03-21T03:26:13.376947Z [info     ] Creating a new page
2024-03-21T03:26:13.917403Z [info     ] A new page is created
2024-03-21T03:26:13.917509Z [info     ] Navigating page to https://www.finditparts.com and waiting for 3 seconds
2024-03-21T03:26:17.559109Z [info     ] Successfully went to https://www.finditparts.com```

Essentially it opens the page and then just stops there.

Is there any log setting to modify to get more verbose logging?

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you connecting over CDP locally? If you turn headless=true does a new window actually open up?

Copy link
Contributor

Choose a reason for hiding this comment

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

Debugging playwright has definitely been a nightmare for us

Copy link
Author

Choose a reason for hiding this comment

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

Yes, connecting locally.

  1. Kill all running chromium processes
  2. Launch a new window by adding the --remote-debugging-port=9222

That pointed me in the right direction. It looks like a lot of the settings needed (like har path) can't be set on an existing browser_context: https://playwright.dev/python/docs/api/class-browsercontext

Although, if I remove the check for using an existing browser context it doesn't launch at all.

Copy link

github-actions bot commented Apr 5, 2024

This pull request is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the Stale label Apr 5, 2024
@suchintan
Copy link
Contributor

@illgitthat This is a great idea -- I'd love to get this merged if you're still open to pushing it across the finish line!

@github-actions github-actions bot removed the Stale label May 10, 2024
@illgitthat
Copy link
Author

@suchintan last time I looked at this I believe it isn't possible due to the limitations in the playwright BrowserContext class needed for an existing object.

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.

None yet

2 participants