https://cypress.io logo
#e2e-testing
Title
# e2e-testing
m

mammoth-fall-22117

05/09/2022, 4:00 PM
I think you should use cy.get() for the field you would like to pass input to.
t

thankful-insurance-51131

05/10/2022, 2:17 PM
hey, thanks for the help. I did manage to get inside of the iframe. However im facing another strange issue now. using cy.get("input") i get an error that there are multiple inputs (which is expected, there are 4). However if I try to get a more specific input ('input[type="tel"]', 'input.classname' || first( 'input') cy does not find it. Any Ideas? Hope you can help again πŸ˜‰
to me it feels like the DOM elements are present, their attributes however are not (concealed mby?)
m

mammoth-fall-22117

05/10/2022, 2:24 PM
hey again! In case you get multiple inputs maybe try combining cy.get("input").first() or cy.get("input").eq(number)?
This is what I do when I have multiple objects with the same id/div/class etc.
t

thankful-insurance-51131

05/10/2022, 2:25 PM
ofc! tyvm
and sry for the thread, i thought discord would treat them like slack
m

mammoth-fall-22117

05/10/2022, 2:25 PM
I don't mind threads, I see them as a nice way to organise comms without clattering the whole channel πŸ˜‰
t

thankful-insurance-51131

05/10/2022, 2:26 PM
my thoughts exactly, can other people see them however?
m

mammoth-fall-22117

05/10/2022, 2:29 PM
I think others can see and decide to join
t

thankful-insurance-51131

05/10/2022, 2:34 PM
Well on with it then πŸ˜‰ ur Idea "works" in the sense cy seems to finds them. However .type does not wrk even with {force:true}
m

mammoth-fall-22117

05/10/2022, 4:07 PM
@polite-lunch-8069
This is my workpal
Maybe he can help as well
Can you share updated code again?
t

thankful-insurance-51131

05/10/2022, 4:09 PM
welcome, and sure gimme a sec
rly dislike using the eq 0,1 on an html element. Only used cuz i was unable to query selectors with cy (It does work in the browser πŸ€·β€β™‚οΈ )
p

polite-lunch-8069

05/10/2022, 4:17 PM
What is the error?
t

thankful-insurance-51131

05/10/2022, 4:18 PM
the type does not work
the test passes put there is no input in the input πŸ˜…
e

early-librarian-87296

05/10/2022, 4:20 PM
if the input contains any text, you could use
cy.contains('input', text)
p

polite-lunch-8069

05/10/2022, 4:21 PM
Maybe object that Cypress gets is not the input it can use to execute .type
t

thankful-insurance-51131

05/10/2022, 4:22 PM
ic, like a radio button
hmm i did only find 4 inputs 1 "tel", 3 text. When i just go for input, cy only detects 4 inputs as well
p

polite-lunch-8069

05/10/2022, 4:23 PM
Or, what happened to me a few times, you need to click this object first in order to execute β€œ.type”
t

thankful-insurance-51131

05/10/2022, 4:23 PM
hmm good idea, ill try
p

polite-lunch-8069

05/10/2022, 4:26 PM
If click doesn’t help just try anything to set focus on this element before using .type (for example you can use .focus)
I think it’s a good practice overall
t

thankful-insurance-51131

05/10/2022, 4:28 PM
ok, so click doesnt seem to find it, focus yields a no input pass again
ill take a break for now will work on it again tomorrow. Thanks for the help, alas this beast might not be slain today πŸ€–
m

mammoth-fall-22117

05/12/2022, 7:25 AM
Hey @thankful-insurance-51131 , Any luck? πŸ™‚
t

thankful-insurance-51131

05/12/2022, 10:47 AM
Hmm not yet. Ty for asking. I'm investigating a shadow root right now. From what I understand it might be the solution
m

mammoth-fall-22117

05/12/2022, 11:34 AM
Interesting!
I am performing many PRD tests lately so can't spare much time to dig deeper into that.
But am curious of the solution.
t

thankful-insurance-51131

05/13/2022, 9:53 AM
Ok by the looks of it, this might have to do with a security measure provided by the 2 iframe or its implementation in the first one. My guess is the solution to this lies outside of the CY-testing scope.
Will lets you know how it turns out in the end
4 Views