Rayrun
← Back to Discord Forum

Unable to handle click using getByLocator action

bhushan.trivediposted in #help-playwright
Open in Discord
bhushan.trivedi

Hi All,My testcase code:- test("Move Product To Wishlist",async({page})=>{ const expectedMessage="Radiant Tee has been moved to your wish list." await page.goto('http://127.0.0.1/246p1/') await page.locator("//div[@class='swatch-opt-1556']//div[@id='option-label-size-144-item-166']").click() await page.locator("//div[@id='option-label-color-93-item-50']").click() await page.locator("//li[1]//div[1]//div[1]//div[4]//div[1]//div[1]//form[1]").click() const successMsgSelector="//div[@data-bind='html: $parent.prepareMessageForHtml(message.text)']" await page.waitForSelector(successMsgSelector) await page.locator("//a[normalize-space()='shopping cart']").click() console.log(successMsgSelector); await page.getByRole('link').click({ name:'Move to Wishlist' }) Error Screenshot attatched:-

Expected Result:- Product should be move to wishlist. Actual Result:- Test timeout of 30000ms exceeded. and unable to execute the testcase.

Please help me to solve this problem.

image.png

This thread is trying to answer question "How can I resolve the issue of not being able to handle a click using the getByLocator action in my test case code?"

0 replies

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 [email protected].