Rayrun
← Back to Discord Forum

Unable to handle radio button locator. its scrolled up and down frequently. Please help for this.

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

I am unable to handle radio button via check and click action. its scroll up and down and my testcase timeout. Video attatched. https://drops.meetanshi.com/v/hjGtMr

This thread is trying to answer question "How can I handle a radio button that scrolls up and down, causing my test case to timeout?"

15 replies
tphillips8117

Did you record the test?

tphillips8117

would be interesting to try it out for myself, that scrolling behaviour is odd

bhushan.trivedi

yes i gave video for understanding purpose nothing else. so i can explain with easy understanding

I can guess the locator you get is not on the box like devs in my company they always create the checkbox with input tag in the messed way. The solution is get the label or span which covered the checkbox not the input one

http://joxi.ru/LmGNdBOcZWj8ar Like in this pic the input locator is the checkbox but bounding box is 1x1 -> it will fail when run test for sure -> get the span or label to get rid of it

bhushan.trivedi

execution log attatched

bhushan.trivedi

when i check or click on review locator then its scrolling down to top and top to down in infinite. not able to handle scrolling

bhushan.trivedi

please help me how can i handle it

bhushan.trivedi

test.only('Add Product Review',async({page})=>{ parent.prepareMessageForHtml(message.text)"]' await page.goto('https://meetanshi.in/m2d1/apple-iphone-x.html') await page.pause() await page.evaluate(()=>{ window.scrollTo(0,document.body.scrollHeight)

})
await page.pause()
await page.locator('//label[@id="Quality_3_label"]').check()

}) - i have tried this test also but still unable to handle this case

bhushan.trivedi
image.png
tphillips8117

Huh, the page even behaves that way when recording a test and I manually click on one of the stars. That's odd!

tphillips8117

This might need a bug report created on github. Very interesting, it does seem like Playwright is being odd

bhushan.trivedi
@tphillips8117: have u check this one on your playwright local browser?

have u check this one on your playwright local browser?

tphillips8117

Yes I have, it's doing exactly what you're describing

bhushan.trivedi
@tphillips8117: Oh thanks for your Kind interest regarding this topic.

Oh thanks for your Kind interest regarding this topic.

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].