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

Content is not fully loaded #40

Open
mir3u opened this issue Mar 19, 2024 · 2 comments
Open

Content is not fully loaded #40

mir3u opened this issue Mar 19, 2024 · 2 comments

Comments

@mir3u
Copy link

mir3u commented Mar 19, 2024

I am testing this library with browser automation on some websites and I have observed that for many of them the content that is lazy is not fully loading (images, js scripts that might load the page). I was wandering why might cause this issue.

@daijro
Copy link
Owner

daijro commented Mar 19, 2024

This issue happens when rendering a Response into a BrowserSession:

resp = session.get('https://www.somewebsite.com/')
page = resp.render()

When setting the content of a page, Playwright doesn't seem to automatically load images and scripts in the website until the page is interacted with. A temporary solution for now is to reload the page immediately after rendering.

I am currently working on a fix for this issue in v0.9.0, which will launch an intermediate locally hosted server for Playwright that will serve the contents of the page, and hopefully allow it to fully render.

@Foxtrod89
Copy link

This issue happens when rendering a Response into a BrowserSession:

resp = session.get('https://www.somewebsite.com/')
page = resp.render()

When setting the content of a page, Playwright doesn't seem to automatically load images and scripts in the website until the page is interacted with. A temporary solution for now is to reload the page immediately after rendering.

I am currently working on a fix for this issue in v0.9.0, which will launch an intermediate locally hosted server for Playwright that will serve the contents of the page, and hopefully allow it to fully render.

I'm getting same problem with javascript is not fully loaded.
I was trying to play with context manager and getting something like <noscript>You need to enable JavaScript to run this app.</noscript>

with hrequests.BrowserSession(browser='chrome', headless=False) as session:
    response = session.get('https://egov.uscis.gov/')
    print(response.content)

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

No branches or pull requests

3 participants