TransWikia.com

Issue with switching / clicking an iFrame jmeter selenium

Software Quality Assurance & Testing Asked by ChathuD on September 5, 2020

enter image description here

As on the image I have to click on the highlighted iFrame and I’m on Jmeter Web Driver Sampler.
The issue is the bottom part of the iFrame id will get change time to time.
So can’t exactly identify it using ID.

If this is with C# then I can get a list with all tag names == iFrame
and click on the selected iFrame.

But with Jmeter Web Driver Sampler I’m not sure how to do something like this.

One Answer

I can see 2 iframes in your picture, one is visible and another one is not visible (the highlighted one).

So you need to:

  1. Locate the iframe element which display property is not none using normal WebDriver.findElement() function which returns a WebElement
  2. Switch to it using the WebElement from the previous step

Example code:

var iframe = WDS.browser.findElement(org.openqa.selenium.By.xpath("//iframe[not(contains(@style, 'display: none'))]")
WDS.browser.switchTo().frame(iframe)

More information: The WebDriver Sampler: Your Top 10 Questions Answered

Answered by Dmitri T on September 5, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP