I need to enter otp as 1234 to an input field and click submit, button child iframe is not getting located. I have used multiple combination of xpaths or css, but no success. I have attached screenshot for your reference and code as well:
Log To Console Locating First Iframe.
${iframe_1}= Get Element iframe#challengeFrame.verify-payment-iframe
Log To Console Log To Console Locating Second Iframe.
TRY
${iframe_2}= Get Element ${iframe_1} >> role=document
#//[@id=‘stepUpView’]//iframe #stepUpView iframe:first-of-type #iframe[id^=‘cardinal-stepUpIframe-’] #(//iframe[contains(@id,‘cardinal-stepUpIframe’)])[1]
EXCEPT
${iframe_2}= Get Element ${iframe_1} >> iframe[name=‘cardinal-stepUpIframe-’]
END
----------------------------Failing here--------------------------------
${otp_field}= Get Element ${iframe_2} >> input[type=“text”].input-field[name=“challengeDataEntry”] #//input[@name=‘challengeDataEntry’]
Log To Console Located OTP Filed
${submit_btn}= Get Element ${iframe_2} >> input[type=“submit”].button.primary[value=“SUBMIT”] #//input[@value=‘SUBMIT’]
Wait And Input Text ${otp_field} 1234
Log To Console Entered OTP
Wait And Click Element ${submit_btn}
Log To Console Clicked Submit Button After Entering OTP. @René@falcon030@damies13BrowserBrowser-Dev
Secondly though the documentation mentions that the selector either side of the frame selector (>>>) can be any valid selector I remember reading somewhere (I can’t find it now) that xpath doesn’t (wasn’t) working on the right of the frame selector (can someone from the Browser Library confirm this and maybe request a documentation update if necessary)
Thirdly, you’re using elemnet objects in your selectors, i.e. ${iframe_1} >> role=document #//[@id=‘stepUpView’]//iframe #stepUpView iframe:first-of-type #iframe[id^=‘cardinal-stepUpIframe-’] #(//iframe[contains(@id,‘cardinal-stepUpIframe’)])[1], ${iframe_1} is an elemnt object so I don’t think this is a valid selector to use here
Also the way you’ve mixed css and xpath selectors there is making things complicated, so I’ll suggest using a simpler selectors, from you html structure I think this should work:
VAR ${iframe_1_sel}= iframe#challengeFrame
${iframe_1}= Get Element ${iframe_1_sel}
Log To Console Log To Console Locating Second Iframe.
VAR ${iframe_2_sel}= ${iframe_1_sel} >>> div#stepUpView iframe
${iframe_2}= Get Element ${iframe_2_sel}
${otp_field}= Get Element ${iframe_2_sel} >>> input[name="challengeDataEntry"]
${submit_btn}= Get Element ${iframe_2_sel} >>> input[value="SUBMIT"]
Thanks @damies13@falcon030 …the issue was trivial…just > was one less…
I realized after posting here.
Thanks for your input. THE ISSUE IS FIXED. by using >>> instead of >>.