Course Content
Selenium Python First Script
Selenium Python First Script
0/2
HTML Form elements
HTML Form elements
0/1
Handle HTML Frames
Handle HTML Frames
0/2
Handling Dropdown Lists
Handling Dropdown Lists
0/2
Selenium Action class
Selenium Action class
0/1
Selenium Python for Beginners [ 2024 ]
About Lesson

WebElement Methods

The WebElement object represents the HTML DOM element. This interface allows you to interact with and perform operations on HTML elements.

Some of the WebElement methods are as follows in table format:  

 

WebElement  Methods Method Description
click() The click() method performs the click operation on the web element. For example, if you have a button on the HTML page, you can use this method to click the button.
send_keys() This method allows you to type text on the element. For example, a textbox element on an HTML page. Use this method to type text in the textbox. This method simulates typing the text on the element.
clear() The clear() method clears the text on the element.
submit() The submit() method submits the HTML form.
get_attribute() The get_attribute() method returns the given attribute or property of the HTML element. If no attribute with the given name exists, ‘None’ is returned.
is_selected() This method returns whether the element is selected.
is_enabled() This method returns whether the element is enabled.

 

For every method call, WebDriver checks if the reference to the web element is valid in the DOM. If it is not, the following StaleElementReferenceException exception will be raised.

Join the conversation