Zagavarr Zagavarr - 4 years ago 324
HTML Question

Get Xpath of an iframe element that has a 'src' attribute containing a certain substring using contains()

In HTML document I have

iframe
, which has a
src
attribute, containing a certain substring "yahoo.com":

<iframe style="width: 100%; height: 100%;" src="https://search.yahoo.com" frameborder="0"></iframe>


What would be the correct Xpath expression for that
iframe
?

How do I use the
contains()
function?

Answer Source

How do I use contains() function?

If you want to select an iframe that contains the string "yahoo.com" in the src attribute, use:

//iframe[contains(@src,'yahoo.com')]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download