Rayrun
← Back to Discord Forum

Dynamic Rendered page not opening as expected

hello all

opening a page normally in my browser opens it something like this

image.png

This thread is trying to answer question "How can I force a page to open in desktop version only in scrapy-playwright?"

10 replies

but when I am opening it in scrapy-playwright in head mode, it opens it something like

image.png

other pages on this website are fine, only these sort of pages are causing this issue. Can someone suggest any fix?

Understood the problem, it is loading up mobile version of the page. How can I force it to open desktop version only?

Or, if you want more granular control...

export default defineConfig({
  projects: [
    {
      name: 'not mobile',
      use: {
        "isMobile": false,
        "hasTouch": false,
      },
    },
  ],
});

Might want to check the setting for the viewport in the pw.config file too...

Yeah it depends on how your SUT determines whether to go mobile mode or not.

@.graff: I tried using the set_viewport_size method of playwright but it doesnt work and opens it in default version only AND the page and the code both abruptly shut down ```py meta = { "playwright": True, "playwright_page_methods": [ PageMethod("set_viewport_size",'{"width": 1920, "height": 1080}'), PageMethod("wait_for_selector", f"(//div[contains(@class,'grid-container')]/descendant::div[contains(@class,'style__container')])[{self.first_page_med}]"), ], "playwright_include_page": True } ```

I tried using the set_viewport_size method of playwright but it doesnt work and opens it in default version only AND the page and the code both abruptly shut down

meta = {
        "playwright": True,
        "playwright_page_methods": [
            PageMethod("set_viewport_size",'{"width": 1920, "height": 1080}'),
            PageMethod("wait_for_selector", f"(//div[contains(@class,'grid-container')]/descendant::div[contains(@class,'style__container')])[{self.first_page_med}]"),
        ],
        "playwright_include_page": True
        }

this is scrapy-playwright download handler to be precise

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.