Web Element Wrapper
Overview
WebElementWrapper provides methods for interacting with located elements.
It operates on the currently active element set by find_element() or find_elements().
The global instance web_element_wrapper is imported from je_web_runner.
Basic Interactions
from je_web_runner import web_element_wrapper
web_element_wrapper.click_element() # Click element
web_element_wrapper.input_to_element("Hello World") # Type text
web_element_wrapper.clear() # Clear content
web_element_wrapper.submit() # Submit form
Attribute and Property Inspection
web_element_wrapper.get_attribute("href") # Get HTML attribute
web_element_wrapper.get_property("checked") # Get JS property
web_element_wrapper.get_dom_attribute("data-id") # Get DOM attribute
State Checks
web_element_wrapper.is_displayed() # Check visibility
web_element_wrapper.is_enabled() # Check if enabled
web_element_wrapper.is_selected() # Check if selected (checkbox/radio)
CSS Property
web_element_wrapper.value_of_css_property("color")
Dropdown (Select) Handling
select = web_element_wrapper.get_select()
# Now use Selenium's Select API:
# select.select_by_visible_text("Option 1")
# select.select_by_value("opt1")
# select.select_by_index(0)
Element Screenshot
web_element_wrapper.screenshot("element") # Saves as element.png
Switching Elements
When find_elements() returns multiple elements, use change_web_element()
to switch the active element:
# After find_elements, switch to the 3rd element (index 2)
web_element_wrapper.change_web_element(2)
web_element_wrapper.click_element()
Element Validation
Validate element properties against expected values:
web_element_wrapper.check_current_web_element({
"tag_name": "input",
"enabled": True
})
Key Attributes
Attribute |
Type |
Description |
|---|---|---|
|
|
Currently active element |
|
|
List of found elements (from |
Methods Reference
Method |
Parameters |
Description |
|---|---|---|
|
Click the current element |
|
|
|
Type text into the element |
|
Clear element content |
|
|
Submit the form |
|
|
|
Get HTML attribute value |
|
|
Get JavaScript property value |
|
|
Get DOM attribute value |
|
Check if element is visible |
|
|
Check if element is enabled |
|
|
Check if element is selected |
|
|
|
Get CSS property value |
|
|
Take element screenshot |
|
|
Switch active element by index |
|
|
Validate element properties |
|
Get Select object for dropdown |