How To Handle Frames And Windows | Playwright With TypeScript Tutorial 🎭| Part VI | LambdaTest

Поділитися
Вставка
  • Опубліковано 2 жов 2024

КОМЕНТАРІ • 35

  • @LambdaTest
    @LambdaTest  2 роки тому +1

    GitHub Repo: github.com/ortoniKC/playwright-ts-lambdatest

  • @k.lakshman1919
    @k.lakshman1919 Рік тому +1

    I had a testdata Json file . In that Json file I had a id value which will change everytime. How to pass variable/dynamic value to the json file ? is it possible .
    I had stored that id value in other page i.e step definition page
    {
    "id": "ruleid",
    "ruleName": "Update-RuleICC",
    "ruleType": "RoutingGuide",
    "ruleDescription": "delete - rule ",
    "effectiveDate": "2023-12-01",
    "expiryDate": "2099-05-01",
    "active": false,
    }

    • @LambdaTest
      @LambdaTest  Рік тому

      Yes, it is possible to pass a variable or dynamic value to the JSON file. One way to achieve this is by using a test data provider function that reads the JSON file and replaces the dynamic value with the value stored in your step definition page.

  • @AhmedTrojan
    @AhmedTrojan Рік тому +1

    How to set position for the window in my screen as set_window_size in selenium

    • @LambdaTest
      @LambdaTest  Рік тому +1

      Hey Ahmed,
      To set the position of the browser window using Selenium, you can use the set_window_position() method. This method takes two arguments: the x-coordinate and the y-coordinate of the top left corner of the window.
      For more selenoum tutorial, you can refer to our selenium playlist ua-cam.com/video/QFHMzWqDPiA/v-deo.html

    • @AhmedTrojan
      @AhmedTrojan Рік тому +1

      @@LambdaTest thx for your interesting bro, but i ask for set_window_position in Playwright not Selenium.
      Thanks again for your content ❤️

    • @LambdaTest
      @LambdaTest  Рік тому

      Hey Ahmed,
      In Playwright, you can set the position of the window using the setWindowBounds method.
      A short snippet for reference 👇🏻
      const { chromium } = require('playwright');
      (async () => {
      const browser = await chromium.launch();
      const context = await browser.newContext();
      const page = await context.newPage();
      // Set the window size to 800 x 600 pixels
      await page.setViewportSize({ width: 800, height: 600 });
      // Set the position of the window to (x, y)
      await page.setWindowBounds({ x: 100, y: 100 });
      await page.goto('www.example.com');
      await browser.close();
      })();
      Please let us know if this helps 🌟

  • @lakshmank249
    @lakshmank249 Рік тому +1

    const myframe = page.frame("//[@src='xxxxx']");
    console.log(myframe)

    await myframe.fill("//*[@id='WACUST']","LakTes")
    myframe value is print in console as null. But the xpth is correct one. I am having only 1 frame

    • @LambdaTest
      @LambdaTest  Рік тому

      Hey Lakshman 👋🏻
      Can you please share the usecase/webpage you are trying to implement this?

  • @paajitales
    @paajitales Рік тому

    How to maximize the window in playwright with Javascript/typescript? Viewport is not working for me. please help me on this?
    projects: [
    {
    name: 'chromium',
    use: {
    ...devices['Desktop Chrome'],
    viewport: { width: 1524, height: 864 },
    },
    },

    • @LambdaTest
      @LambdaTest  Рік тому

      Hey there 👋
      The viewport sets the size of the render area for the webpage and doesn't affect the window size of the browser. If you need to maximize the window in Playwright, you can use the BrowserContext object's newPage method in combination with the BrowserWindow object's maximize method.
      Let us know if this helps.

  • @AdmixKraft
    @AdmixKraft 2 роки тому +1

    Nice video 😍 I have a question - how do I use a selector to find and interact with ?

    • @LambdaTest
      @LambdaTest  2 роки тому

      Hey Mansi, There are lots of selectors to choose from to interact with iFrames. Here's the video that can help you: ua-cam.com/video/JN16nilL8Wg/v-deo.html

  • @venkataitharaju5493
    @venkataitharaju5493 2 роки тому +1

    Hi, nice video, I am struck with the scenario where I have pop up window in a , I am not able to use click event on the page element as the element is nested in , any idea how to handle this

    • @LambdaTest
      @LambdaTest  2 роки тому

      Hey Venkat,
      You can check more about s in this blog debbie.codes/blog/testing-s-with-playwright/.
      Let me know if this helps

  • @kinzakhan7698
    @kinzakhan7698 2 роки тому +1

    Great video 😀 Can you please advise on how to deal with the dropdown boxes inside the frames?

    • @LambdaTest
      @LambdaTest  2 роки тому

      Hi Kinza, Handling dropdown is quite easy with Playwright. We have covered that already in this video: ua-cam.com/video/FUvH1l4o7Os/v-deo.html

  • @engamyc4668
    @engamyc4668 Рік тому

    Very nice video and it is really useful for me. I'm still new to the auto testing and I have a question here. I'm using codeceptjs for the auto testing here. There is no waitForEvent appended with the actor I. Then what should I do to switch btw these popup windows?

    • @LambdaTest
      @LambdaTest  Рік тому +1

      Hey there 👋🏻
      Thank for such kind words and glad you liked our videos!
      In CodeceptJS, the I.switchTo() command can be used to switch between windows, s, or even within shadow DOM.
      To switch to a new popup window, you can use I.switchToNextTab(). If you want to switch back to the main window, you can use I.switchToPreviousTab().

    • @engamyc4668
      @engamyc4668 Рік тому

      @@LambdaTest Thank you for your reply. I have one more question. I'm using playwright in the concepts, and try to login with my Google account. but Google give me an error message like: this browser or app may not be secure. I was trying to use the stealth, but the problem exists. Any recommendations?

  • @meenachauhan8824
    @meenachauhan8824 2 роки тому +1

    Excellent video content 😍 I loved it! Will there be any more videos in this series?

    • @LambdaTest
      @LambdaTest  2 роки тому

      Hey Meena, Thanks for liking the videos. Yes, you can keep following this Playwright Testing Playlist for more videos

  • @kaushikichauhan2362
    @kaushikichauhan2362 2 роки тому +1

    Amazing series in Playwright 🔥🔥

  • @priyadarsini6788
    @priyadarsini6788 Місяць тому

    I'm in page, but after clicking continue button it is reloading the same page, url and DOM got changed which is not in and I'm not able to access the page, Can you please let me know how to handle this?

    • @LambdaTest
      @LambdaTest  Місяць тому

      Hey @priyadarsini6788, you can Switch to the , click the button, then switch back to the main content using driver.switchTo().defaultContent(). This allows you to interact with the new page after it reloads outside the .
      Hope this helps :)

    • @LambdaTest
      @LambdaTest  Місяць тому

      Hi Priyadarsini,
      To handle navigation and click in one line, please use this command -
      await Promise.all([page.waitForNavigation(), page.frameLocator('[name="your__name"]').locator('button#continue').click()]);

    • @priyadarsini6788
      @priyadarsini6788 Місяць тому

      ​​​@@LambdaTest ​ Can you please let me know what we can use in typescript for switchto default content?

    • @LambdaTest
      @LambdaTest  Місяць тому

      Hi Priyadarsini,
      In TypeScript with Playwright, there isn't a direct switchToDefaultContent() method like in Selenium.
      However, switching to the default content (main frame) can be achieved using page.mainFrame() method in Playwright.

  • @muralivasudev6482
    @muralivasudev6482 Рік тому

    Great Video . Can you please advice how to deal with refreshing the frame alone?🙏

    • @LambdaTest
      @LambdaTest  Рік тому

      Hey Murali,
      Can you please refer to the frame documentation page playwright.dev/docs/api/class-frame

  • @CosbandOniShade
    @CosbandOniShade Рік тому

    Great video! Can we drag video from one tab to another tab?

    • @LambdaTest
      @LambdaTest  Рік тому

      Hey Oni,
      We definitely can. Please have a look at this video ua-cam.com/video/qPvmSHffI2A/v-deo.html