I am trying to interact with elements within a frame.

    <frame name="content" scrolling="AUTO" src="empty.jsp">
     <html lang="en">
      <body onload="changeModelEntries(window.document.forms['mensForm'].manufacturer.options[window.document.forms['mensForm'].manufacturer.selectedIndex].value)" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <form name="mensForm" method="post" action="/aeu/mensSearch.do">
       <input type="hidden" name="resultsPerPage" value="25">
       <input type="hidden" name="searchName" value="getMensClothing">
       <input type="hidden" name="selectedIndex" value="-1">
       <input type="hidden" name="formContextKey" value="">

I can successfully access the frame body by using Cypress' suggested custom commands:

    //Login code here 
    const getContentFrameDocument = () => {
    return cy

    const getContentFrameBody = () => {
    // get the document
    return getContentFrameDocument()


So that getContentFrameBody() yields a successful assertion yet when I try and chain off it to access elements within the frame:


I get a timeout on the assertion:

Timed out retrying: Expected to find element: form[name="mensForm"], 
but never found it. Queried from element: <body>

I'm wondering I need another command to get inside the #document of frame=content? Could it be related to the onload event?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.