Я пытаюсь выбрать раскрывающийся список с помощью Cypress. Когда я использую Cypress Open Selector Playground и указываю на веб-элемент, я получаю cy.get ('. Dropdown-placeholder'). Type ('Name')
Я получаю сообщение об ошибке:
CypressError
Timed out retrying: cy.type() failed because this element is detached from the DOM.
<div class="Dropdown-placeholder"></div>
Cypress requires elements be attached in the DOM to interact with them.
The previous command that ran was:
> cy.get()
This DOM element likely became detached somewhere between the previous and current command.
Common situations why this happens:
- Your JS framework re-rendered asynchronously
- Your app code reacted to an event firing and removed the element
You typically need to re-query for the element or add 'guards' which delay Cypress from running new commands.Learn more
, и когда я пытаюсь получить селектор CSS для фактической записи, я получаю: cy.get (': nth-child (3)> #Question> .Dropdown- root> .Dropdown -control> .Dropdown-placeholder ')
при попытке cy.get('.Dropdown-placeholder').focus().type('Name')
я получаю ошибку:
cy.focus() can only be called on a valid focusable element. Your subject is a: <div class="Dropdown-placeholder"></div>
, а для: cy.get('.Dropdown-placeholder').click().type('Name')
я получаю ошибку:
CypressError
Timed out retrying: cy.click() failed because this element is detached from the DOM.
<div class="Dropdown-placeholder"></div>
Cypress requires elements be attached in the DOM to interact with them.
The previous command that ran was:
> cy.get()
This DOM element likely became detached somewhere between the previous and current command.
Common situations why this happens:
- Your JS framework re-rendered asynchronously
- Your app code reacted to an event firing and removed the element
You typically need to re-query for the element or add 'guards' which delay Cypress from running new commands.Learn more
А вот HTML:
<div class="Dropdown-root module-Questions-module-dropDownContainer--2bcD7--"><div class="Dropdown-control" aria-haspopup="listbox"><div class="Dropdown-placeholder is-selected">Name</div><div class="Dropdown-arrow-wrapper"><span class="Dropdown-arrow"></span></div></div></div>