seleniumtestinglib.TargetLocator.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-testing-library Show documentation
Show all versions of selenium-testing-library Show documentation
Selenium locators that resemble the Testing Library (testing-library.com)
The newest version!
package seleniumtestinglib
import org.openqa.selenium.By
import org.openqa.selenium.By.tagName
import org.openqa.selenium.NoSuchFrameException
import org.openqa.selenium.WebDriver
fun WebDriver.TargetLocator.frame(selectorWithinIFrame: By): WebDriver {
defaultContent().findElements(tagName("iframe")).forEach {
val iFrame = defaultContent().switchTo().frame(it)
iFrame.findElements(selectorWithinIFrame).firstOrNull()?.let { return iFrame }
}
throw NoSuchFrameException("iframe for selector $selectorWithinIFrame does not exist")
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy