Click element present under iframe by its xpath

Hello all,

Is there anyway by which we can click an element (e.g. link, span, etc under iframe) which is present under iframe e.g. using its xpath ?
Please suggest. TIA.

Regards

1 Like

Hi @Murali, for generating selectors you might try the TruePath addon for both Firefox and Chrome - here is a link to a YouTube video by Sumit Gosh, which indicates there is iframe support. I also use ChroPath for Firefox and ChroPath for Chrome, by Sanjay Kumar. ChroPath is in very active development.

I would be interested to know your results!

Regards,
burque505

1 Like

Thanks @burque505 . I was able to generate xpath for required link and it works well from chropath. But the issue is this element is present under iframe and I need to click it from Robin code. In selenium we switch frame and click it.

Wanted to know how we can handle in Robin. Something similar to below post but for clicking link/button by its xpath

Hello @Murali, feel free to check this out as well:

3 Likes

Thanks a lot @jokoum. First method has worked like carm :smiley:

  1. However, could you please let me know why the javascript method is not working for me? I am trying to one link under iframe. PFA screenshots of code and page dom.

  2. Also, do you know how to handle iframe in iframe ?

  3. And switch windows? Like to move to popup window and come back to origin window.
    TIA.

@jokoum plz let me know if you have any thoughts on my 3 queries? TIA.

@Murali

  1. I don’t know a lot about Javascript, but your syntax seems wrong. The document.querySelectorAll() statement returns all the elements that apply to the selector that follows in a list type variable. Try the document.querySelector() instead. The provided selector seems also wrong. I will not proceed in further troubleshooting on this topic, as I am not a Javascript expert and I think it is out of the community scope.

  2. iframe inside another iframe can be treated in a similar way as described, however the procedure must be performed twice, once for the first iframe and once for the second one in the tree HTML structure.

  3. Switching Web Browser windows can be performed by giving different browser instances to each one of them, using the attach actions. For example, if you make use of IE browser, the following action can be used:
    WebAutomation.AttachToInternetExplorerByTitle TabTitle: 'Robin' BrowserInstance=> RobinBrowser

2 Likes

@jokoum thanks a lot

1 Like