I can bind radio

This commit is contained in:
2025-11-07 21:28:19 +01:00
parent cc11e4edaa
commit e8ecf72205
12 changed files with 965 additions and 156 deletions

View File

@@ -300,7 +300,7 @@ class TestableElement:
self.fields[name] = raw_value
elif name not in self.fields:
# If no radio is checked yet, don't set a default
pass
self.fields[name] = None
elif input_type == 'number':
# Number: int or float based on value
@@ -1104,6 +1104,9 @@ class TestableRadio(TestableControl):
source: The source HTML or BeautifulSoup Tag.
"""
super().__init__(client, source, "input")
nb_radio_buttons = len(self.element.find_all("input", type="radio"))
assert nb_radio_buttons > 0, "No radio buttons found."
assert nb_radio_buttons < 2, "Only one radio button per name is supported."
self._radio_value = self.my_ft.attrs.get('value', '')
@property
@@ -1573,6 +1576,9 @@ class MyTestClient:
f"Found {len(remaining)} forms (with the specified fields). Expected exactly 1."
)
def find_input(self, identifier: str) -> TestableInput:
pass
def get_content(self) -> str:
"""
Get the raw HTML content of the last opened page.