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.
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.