柏树单击具有SPRC的表中的nth图像
我在表中有一个项目列表,每个项目都有一个图像,活动(蓝色)和非活动(黑色),如何对 cypress 进行此查询。
当展开图像时,它的 src 路径为 /static/images/icon_profile.png
我当前的测试是这样的:
it('Should create a legal form of a Customer profile', ()=>{
cy.get('th').eq(50).find('img').should('have.attr', 'src', '/static/images/icon_profile.png').first().click()
})
但是当我运行它时,我收到此错误:
I have a list of items in the table, each item has an image , active (blue) and not active (black), how do I make this query for cypress.
This is the image of the table list :
Then this is the html code for the table :
When expanded the image is below, it has a src path of /static/images/icon_profile.png
My current test is like this :
it('Should create a legal form of a Customer profile', ()=>{
cy.get('th').eq(50).find('img').should('have.attr', 'src', '/static/images/icon_profile.png').first().click()
})
But when I ran it I get this error :
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过组合选择器来更轻松地完成此操作。
使用
.eq(50)
运行时确认您拥有正确的索引You can do it more easily by combining selectors
To confirm you have the right index when using
.eq(50)
run你可以做这样的事情
You can do something like this