0

If the HTML code looks like this

<div class="something">
  <div>
   <iframe src="something">
``` how would I be able to switch the iframe to that above using selenium in nodejs

1 Answers1

0

To switch to the <iframe> you can use the following lines of code:

// Store the web element
const iframe = driver.findElement(By.css('div.something > div > iframe[src="something"]'));

// Switch to the frame
await driver.switchTo().frame(iframe);
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • https://prnt.sc/KCG2IFmDMMca - I tried on doing `let button = tab.findElement(swd.By.css("div.class here > div > iframe[src='link']"));` but it says it cant find element – Ricky Rodrigo Mar 19 '22 at 13:50