1

I can't access to some iFrame by selenium (node js + mocha) in the website below -

https://www.rt.com/uk/421078-may-skripal-russia-parliament/

The required iframe element -

<iframe id="5645d42cb79d139a24d943622da2c47d-iframe" src="https://spoxy-shard5.spot.im/v2/spot/sp_6phY2k0C/post/421078/?elementId=b2ec2c94ee1c35810c76e1704dbe3d06&amp;spot_im_platform=desktop&amp;host_url=https%3A%2F%2Fon.rt.com%2F90wm&amp;host_url_64=aHR0cHM6Ly9vbi5ydC5jb20vOTB3bQ%3D%3D&amp;spot_im_ph__prerender_deferred=true&amp;prerenderDeferred=true&amp;sort_by=best&amp;isStarsRatingEnabled=false&amp;enableMessageShare=true&amp;enableAnonymize=false&amp;isConversationLiveBlog=false&amp;enableSeeMoreButton=true" scrolling="no" style="overflow: hidden; height: 2339px;" data-frame-unique-id="a6cbebb1116a32e10263270bfde7e0c1" data-conversation-id="sp_6phY2k0C_421078"></iframe>

I want to send keys to the input elements inside it -

enter image description here

Please your help, thanks.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Idan E
  • 1,299
  • 4
  • 17
  • 42

1 Answers1

0

You can switch to the specific frame you can use either of the following options :

  • CSS :

    iframe[id$='-iframe'][src^='https://spoxy-shard5.spot.im/v2/spot/sp_']
    
  • XPATH :

    //iframe[contains(@id,'-iframe') and starts-with(@src,'https://spoxy-shard5.spot.im/v2/spot/sp_')]
    

Note : You may require to induce wait for the intended frame to be available and switch to it. You will find a detailed discussion in How can I select a html element no matter what frame it is in in selenium?. See the A Better Approach to Switch Frames section.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352