github seleniumbase/SeleniumBase v3.5.1
3.5.1 - Add a Context Manager method for switching into iframes using a "with" statement

latest releases: v4.27.0, v4.26.4, v4.26.3...
22 months ago

Add a Context Manager method for switching into iframes using a with statement

Here's an example test that demonstrates this feature:

from seleniumbase import BaseCase

class FrameTests(BaseCase):
    def test_iframes_with_context_manager(self):
        self.open("https://seleniumbase.io/w3schools/iframes.html")
        with self.frame_switch("iframeResult"):
            self.assert_text("HTML Iframes", "h2")
            with self.frame_switch('[title*="Iframe"]'):
                self.assert_text("This page is displayed in an iframe", "h1")
            self.assert_text("Use CSS width & height to specify", "p")
            with self.frame_switch('[title*="Iframe"]'):
                self.assert_text("seleniumbase.io/w3schools/iframes", "a")
        self.click("button#runbtn")
        with self.frame_switch("iframeResult"):
            self.highlight('iframe[title="Iframe Example"]')

Don't miss a new SeleniumBase release

NewReleases is sending notifications on new releases.