Playwright Automation Issue: TypeError on Zoom’s JavaScript Library Occurs Only on Server, Not Locally

  Kiến thức lập trình

I conducted a test on the Zoom website using the Playwright library to automate the login process and then update account information for several accounts. The issue only occurs on the server and not on my local machine (development machine). It seems that the problem lies within one of the JavaScript libraries, as indicated by the following error:

TypeError: Cannot read properties of undefined (reading '$t')
    at https://st1.zoom.us/fe-static/fe-signup-login-active/js/app.fd1956f3.js:1:102098

At first, I thought the issue was due to not waiting for the page to fully load before starting the login process. I added a mechanism to wait for all resources to load before proceeding with the login, but the same issue persisted.

await page.WaitForLoadStateAsync(LoadState.NetworkIdle);

I also implemented several wait mechanisms between each stage, although I believe these measures should be unnecessary since this library uses async/await in all its operations.Additionally, I tried using the Selenium library, but I encountered the same issue.

OS: Windows Server 2022
NodejS: 20.16.0
Playwright: 1.46.0

Full Code

  using var playwright = await Playwright.CreateAsync();

  
   BrowserTypeLaunchOptions? options = new()
   {
       Headless = info.headless,
        ExecutablePath = TGlobalUtils.GetChromePath() //google chrome path
   };


   var browser = await playwright.Chromium.LaunchAsync(options);



// "1. Create a new incognito browser context".Log();
   var context = await browser.NewContextAsync(new BrowserNewContextOptions
   {
       UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
   });
   context.SetDefaultNavigationTimeout(600000);
   context.SetDefaultTimeout(600000);

   var page = await context.NewPageAsync();
//Log errors to console and file
   page.PageError +=  (_, e) => {
       e.Log(ConsoleColor.Red);
       e.LogF(TLogType.ltError, "errors");
   };


// "2. Open the Zoom sign-in page".Log();
   await page.GotoAsync("https://us05web.zoom.us/signin");
   await page.WaitForLoadStateAsync(LoadState.NetworkIdle);


// "3. Input email and password".Log();
   await page.FillAsync("#email", info.FullEmail);
   await page.FillAsync("#password", info.EmailPaswword);

   await page.WaitForTimeoutAsync(1000);

// "4. Press the login button".Log();
   await page.ClickAsync("#js_btn_login"); // this is login button 

// "5. Wait for navigation based on conditions.".Log();
   await page.WaitForTimeoutAsync(2000);
// *************** ERROR RAISED HERE AND STUCK *******************
   await page.WaitForNavigationAsync(new PageWaitForNavigationOptions
   {
       UrlRegex = new Regex("(/myhome|/signin/otp/verify_help)"),
       Timeout = 600000 // Wait up to 60 seconds
   });
 

Thank you.

0

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT