0

I'm doing an RPA in Python and I'm having a problem trying to access this site:

My code:

        browser = await playwright.chromium.launch(channel='msedge', headless=False, args=['--start-maximized'], slow_mo=1000) #headless=False, args=['--start-maximized']
        page = await browser.new_page(accept_downloads=True, no_viewport=True) #no_viewport=True
        page.set_default_navigation_timeout(90000)
        page.set_default_timeout(90000)

        await page.goto(WEBSITE)
        for item in [USER, PASSW]:
            if item == USER:
                await page.fill(item, EMAIL)
            else:
                await page.fill(item, PASSWORD)
        await page.click(LOGIN)
        await page.wait_for_timeout(1000)

Error: IMAGE

I've already tried using the user-agent, removing the properties, using context, using variables with the lowercase name and I keep getting the same error, sorry for any mistakes, it's my first post!

  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 03 '22 at 05:26
  • What are you trying to do? Which site are you trying to access? – ggorlen Jul 15 '22 at 22:01
  • @ggorlen I don't remember :) –  Aug 02 '22 at 14:42

1 Answers1

0

this worked for me in java:

Page page = browser.newPage();
Map<String, String> headers = new HashMap<>();
headers.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) `enter code here`AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36");
page.setExtraHTTPHeaders(headers );
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 06 '22 at 03:32
  • 2
    OP, is asking for an answer in Python. – rachwa Aug 10 '22 at 19:02