简体   繁体   English

无法获取我的弹出式注册元素

[英]Unable to get element of my pop up sign up

Cypress is not able to find the XPath or element location of the pop up sign up. Cypress 无法找到弹出式注册的 XPath 或元素位置。 I want to enter email and password, confirm password and then enter.我要输入邮箱和密码,确认密码后再输入。 But I am unable to get the elements of these fields.但是我无法获取这些字段的元素。 Can someone please tell me how to take xpaths or locators of the pop up forms.有人可以告诉我如何获取弹出表单的 xpath 或定位器吗? I am attaching the link and image below for more clarity https://birdhunt.bubbleapps.io/version-test/为了更清楚起见,我附上了下面的链接和图片https://birdhunt.bubbleapps.io/version-test/ 在此处输入图像描述

The xpath is valid, so it's likely you forgot to add the cypress-xpath add-in. xpath 有效,因此您可能忘记添加 cypress-xpath 加载项。

See the documentation here请参阅此处的文档

Install with npm使用 npm 安装
npm install -D @cypress/xpath

Install with Yarn yarn add @cypress/xpath --dev使用 Yarn yarn add @cypress/xpath --dev

Then include in your project's support file然后包含在项目的支持文件中
require('@cypress/xpath');

But you are using cy.get() with an xpath expression, which should be obvious mistake.但是您将cy.get()与 xpath 表达式一起使用,这应该是明显的错误。

Either use cy.get('css-selector-here') or use cy.xpath('xpath-expression-here') .使用cy.get('css-selector-here')或使用cy.xpath('xpath-expression-here')

To complete, you should use relative XPath expressions instead of absolute ones.要完成,您应该使用相对 XPath 表达式而不是绝对表达式。 In your case:在你的情况下:

//input[@placeholder="Email"]
//input[@placeholder="Password"]
//input[@placeholder="Confirm password"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM