kaleidosJohna
kaleidosJohna
  • 发布:2025-01-10 13:59
  • 更新:2025-01-10 13:59
  • 阅读:15

【自动化测试】offset无效。用page.$$获取元素list的offset都是同一个

分类:HBuilderX

如题

            const main_history_list =await page.$('.main_history_list')  
        const list = await main_history_list.$$('.main_history_list_item_text')  
            const first_item = list[0]  
            const first_item_text=await first_item.text()  
            console.log("first_item_text", first_item_text)  
            const first_item_offset = await first_item.offset()  
            console.log("first_item_offset", first_item_offset)  
            expect(first_item_offset.top).toBeGreaterThan(0)  
            const last_item = list[list.length-1]  
            const last_item_text=await last_item.text()  
            console.log("last_item_text", last_item_text)  
            const last_item_offset = await last_item.offset()  
            console.log("last_item_offset", first_item_offset)  
            expect(last_item_offset.top).toBeGreaterThan(0)

offset的值都是同一个
打印的text和元素id都不一样

2025-01-10 13:59 负责人:无 分享
已邀请:

要回复问题请先登录注册