AnswerBun.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!

Related Questions

Variable in Xpath is not working

1  Asked on October 25, 2021 by user46038

     

Running Selenium not under a Testing Framework

1  Asked on February 12, 2021 by sebastian-inones

     

How to set app path for android using Appium on a mac

5  Asked on February 3, 2021 by user1523236

 

Python Dryscrape – how to select child element

1  Asked on January 25, 2021 by haroon-amjad

   

How to read the row number with having column data?

1  Asked on January 21, 2021 by user32519

   

Winapp driver not support web elements

1  Asked on December 28, 2020 by user24314

   

Ask a Question

Get help from others!

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