2023-02-21

How to switch frames using name attribute with wildcards in Selenium

I am challenged by this error using Wildcard(*) in a string to locate a frame. When I write the complete name of the iFrame in the statement, it has no issues finding the Frame.

driver.SwitchTo().Frame("*_ifr") 
OpenQA.Selenium.NoSuchFrameException: 'No frame element found with name or id *_ifr'

When I enter the entire frames name like below, it works just fine

driver.SwitchTo().Frame("txt-client-instructions_ifr") 

I expect the wildcard will find the following iframes:

  • 1st txt-client-instructions_ifr
  • 2nd 107314_100323_ifr
  • 3rd 107341_100324_ifr
  • 4th 100321_macrotext_ifr

Your thoughts are appreciated!



No comments:

Post a Comment