https://cypress.io logo
Idk if this is much of a cypress question but I am...
# general-chat
f
Idk if this is much of a cypress question but I am having an issue with cypress. I have a cshtml page that I need to inject a
data-cy
or a class so I can select the element as the select and input elements are not on the page for me to select and cypress keeps giving me an error stating that
the element is not visible because it has an effective width and height of: 402 x 0 pixels. Fix this problem, or use {force: true} to disable error checking.
I want to fix the problem but idk how since it is cshtml and the HTML for this can’t be found anywhere. I tried JQuery and JavaScript to get the element by the ID and add a class but since there are no classes already, it is failing (at least I think that is why no errors in the console). Not shere who or where to ask for this.
d
Hi, from your description if the element you want to select is generated in cshtml, you can modify it in Razor view to include the class or data-cy attribute using @Html.TextBoxFor. I'm not very good with Razor syntax expression, it might be helpful to refer to the documentation.