Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
How do I create testcafe selector element when the iframe has only src?

I have a following iframe section which i would like to use for further actions

    <div class="addonWrapper"><div class="detailhead mobileonly">   
    <div class="cancelbtn cancelmobileiframebtn" title="Zurück" onclick="closeMobileIFrame()"></div></div>
    <iframe src="https://abcd.php?stage=1&amp;access_token=zrhrhha8b-621bb319cd38d-1348650f57bf2b8d70fbc84d95b747ab" style="width: 100%; height: 100%; border: none;"></iframe>
    </div>

i have tried to do something like this.

this.iframeM = Selector('iframe').withAttribute(
            'src',
            'https://abcd.php?stage=1&amp;access_token=zrhrhha8b-621bb319cd38d-1348650f57bf2b8d70fbc84d95b747ab'
        );

then in the test

await t.switchToIframe(mPage.iframeM);

But its not successful. I keep getting the error "The specified selector does not match any element in the DOM tree.!"

What is the best way to identify the iframe in this case where only src is available. Help would be deeply appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Can you try following ?

  1. Use regular expression instead of the exact value of the attribute

https:\/\/abcd.php\?stage=1.*


this.iframeM = Selector('iframe').withAttribute(
            'src',/https:\/\/abcd.php\?stage=1.*/
        );

Reference : Selector with .withAttribute Method

  1. Increase the timeout value for iFrame Reference : Increase the timeout value for the iFrame

  2. Run the test in debug mode Run the test in debug mode and execute the iFrame specific code when the frame is loaded.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!