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

247
Views
How to play a video inside an iframe using selenium with node.js?

I'm trying to play a video inside an <iframe> using selenium with node.js. I have tried

`driver.sleep("2000");
await driver.switchTo().frame(0);
let playVideo = By.id("shakaVid");
// await driver.switchTo().frame(driver.findElement(playVideo));
await driver.wait(until.elementLocated(playVideo), 15*1000);
await driver.findElement(playVideo).play();`

I'm getting TimeoutError: Waiting for element to be located By(css selector, *[id="shakaVid"]) I have also tried By.css("iframe html > body > video") but none of these are working. And I don't know how to test that selenium is shifting its focus to iframe. So, I have tried multiple things.

This is how my html is : Elements

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

0

Looks like that's not the first frame, try giving web element for iframe instead of indexing:

let iframe = By.cssSelector("iframe[name^='vdoFrame'][src*='playerAssets']");
await driver.switchTo().frame(driver.findElement(iframe));

if this css selector iframe[id^='vdoFrame'][src*='playerAssets'] is locating the right iframe (Please verify that in element section when we inspect), then you should be able to switch to iframe and rest of your code should work just fine.

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!