from seleniumbase import BaseCase


class MyTestClass(BaseCase):

    def test_demo_page(self):
        # Load a local html file into the browser
        self.load_html_file("demo_page.html")

        # Assert that the element is visible on the page
        self.assert_element("tbody#tbodyId")

        # Assert that the text appears within a given element
        self.assert_text("Demo Page", "h1")

        # Update the text of various text fields on the page
        self.update_text("#myTextInput", "This is Automated")
        self.update_text("textarea.area1", "Testing Time!\n")
        self.update_text('[name="preText2"]', "Typing Text!")

        # Verify that a button click changes text on the page
        self.assert_text("This Text is Green", "#pText")
        self.click("#myButton")
        self.assert_text("This Text is Purple", "#pText")

        # Verify that the hover dropdown option changes text
        self.assert_text("Automation Practice", "h3")
        self.hover_and_click("#myDropdown", "#dropOption2")
        self.assert_text("Link Two Selected", "h3")

        # Verify that the "select" option updates a meter bar
        self.assert_element('meter[value="0.25"]')
        self.select_option_by_text("#mySelect", "Set to 75%")
        self.assert_element('meter[value="0.75"]')

        # Assert an element located inside an iFrame
        self.assert_false(self.is_element_visible("img"))
        self.switch_to_frame("#myFrame1")
        self.assert_true(self.is_element_visible("img"))
        self.switch_to_default_content()

        # Assert text located inside an iFrame
        self.assert_false(self.is_text_visible("Frame Text"))
        self.switch_to_frame("#myFrame2")
        self.assert_true(self.is_text_visible("Frame Text"))
        self.switch_to_default_content()

        # Verify that clicking a checkbox makes it selected
        self.assert_false(self.is_selected("#checkBox1"))
        self.click("#checkBox1")
        self.assert_true(self.is_selected("#checkBox1"))

        # Verify that clicking a radio button selects it
        self.assert_false(self.is_selected("#radioButton2"))
        self.click("#radioButton2")
        self.assert_true(self.is_selected("#radioButton2"))

        # Assert that the SVG is visible on the page
        self.assert_element('svg[name="svgName"]')

        # Assert the title of the current web page
        self.assert_title("Web Testing Page")

@@ -1,8 +1,56 @@
+from selenium.webdriver.common.keys import Keys%0A
 from sel
@@ -1126,24 +1126,253 @@
 ed%22, %22h3%22)%0A%0A
+        # Verify that moving a %22slider%22 updates a progrss bar%0A        self.assert_element('progress%5Bvalue=%2250%22%5D')%0A        self.send_keys(%22#myslider%22, Keys.RIGHT + Keys.RIGHT)%0A        self.assert_element('progress%5Bvalue=%22100%22%5D')%0A%0A
         # Ve

Update the test for the Demo Page