-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encountering tagName.toLowerCase is not a function. Please help #8191
Comments
This is being thrown from within Cypress at this line, so is a bug: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/dom/elements.ts#L357:L357 This code hasn't really been changed since 3.5.0, so it's strange that it's just now occurring as I haven't seen anyone else with this error. This seems to be implying that Element.tagName is returning something other than a String (not undefined or null though). But the very definition of this is that it returns a String. Is there any way you can provide an example to reproduce this? Or some hints on something outside of regular DOM elements that you're using in your web application (shadow dom, web components, etc)? I can't reproduce it with the information provided which means we can't exactly track down how to go about fixing it. You can also email any info needed to reproduce to support@cypress.io if you don't want to publicly post. |
Hi @jennifer-shehane , I have sent a detailed email to the address provided. Please look into it and let me know if there is a solution. Thanks ! |
Closing as a reproducible example was never provided. Please comment if there is new information to provide concerning the original issue and we can reopen. |
@jennifer-shehane When moving from cypress 4.8 to cypress 4.9-5.3 I am seeing this error. Previously this block of code ran and produced a result:
After upgrading to version 4.9 or attempting an upgrade to the latest I get these errors when the test runs: It errors out on the .should() portion of the code. I have tried getting rid of the .then and use a .should against the invoke but the same error occures.
|
A minimal reproduction that likely points to a root cause:
<!DOCTYPE html>
<body>
<form>
<input id="tagName" type="text" />
</form>
</body>
describe('page', () => {
it('works', () => {
cy.visit('cypress/fixtures/form.html')
cy.get('#tagName').should('exist')
cy.get('form').should('exist')
})
}) This is due to how inputs with IDs interact with the form element itself: All input IDs that are children of a form become properties on that const form = document.createElement('form')
console.log(form.tagName === 'FORM') // true
const input = document.createElement('input')
input.id = 'tagName'
form.appendChild(input)
console.log(form.tagName === 'FORM') // false
console.log(form.tagName === input) // true The primary workaround is to not give input elements IDs that will overwrite properties of the |
Hello @jennifer-shehane - do we have any update on this issue? |
Hi, I'm trying to automate a web application built on Angular on the front end.
I have a form where I need to click a button.
Html Code :
Javascript code to click :
Error in Cypress runner :
I do not understand why I see the
tagName.toLowerCase()
function while executing a click on the ADD BUTTON of the form page.There is no function with that name in my code.STEPS TO REPRODUCE
Expected : The element must be clicked.
Actual : I see the error in Cypress Runner as above.
NOTE :
Seems like a bug to me as I consulted my developer and there is no such method in his code.
The text was updated successfully, but these errors were encountered: