Selenium Articles

Page 2 of 37

Action Chains in Selenium Python

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 6K+ Views

Action chains in Selenium Python enable the execution of multiple browser actions together in sequence. Selenium is a popular open-source automation testing tool used to test web applications and automate browser actions. Action chains allow you to combine multiple actions like clicks, key presses, and mouse movements into a single automated workflow. What are Action Chains in Selenium Python? Action chains are a sequence of actions that are performed in a specific order on a web page to test for a specific outcome. These actions can include clicking elements, entering text, scrolling, dragging and dropping objects, and keyboard ...

Read More

Running Selenium Webdriver with a proxy in Python.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 25-Mar-2026 4K+ Views

We can run a proxy with Selenium webdriver in Python. A proxy is an essential component to do localization testing. We can take an e-commerce application and check if the language and currency visible is as per the user location. With the help of proxy within tests, we can verify if the website user interface matches with the location. We have to set a proxy with below steps − Import webdriver from Selenium package. Define proxy server address. Create an object of ChromeOptions class Communication of proxy with ChromeOptions. Summing options to Chrome() object. Basic ...

Read More

Selenium and Python to find elements and text?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 25-Mar-2026 796 Views

We can find elements and extract their text with Selenium webdriver. First, identify the element using any locator like id, class name, CSS selector, or XPath. Then use the text property to obtain the text content. Syntax element_text = driver.find_element(By.CSS_SELECTOR, "h4").text Here driver is the webdriver object. The find_element() method identifies the element using the specified locator, and the text property extracts the text content. Modern Selenium Approach Recent Selenium versions use the By class for locators instead of the deprecated find_element_by_* methods ? from selenium import webdriver from selenium.webdriver.common.by import ...

Read More

How to set Selenium Python WebDriver default timeout?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 25-Mar-2026 7K+ Views

Setting default timeout in Selenium Python WebDriver helps prevent tests from hanging indefinitely. Selenium provides two main approaches: set_page_load_timeout() for page loading and implicitly_wait() for element location. Page Load Timeout The set_page_load_timeout() method sets a timeout for page loading. If the page doesn't load within the specified time, a TimeoutException is thrown. Syntax driver.set_page_load_timeout(timeout_in_seconds) Example from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.common.exceptions import TimeoutException # Setup WebDriver service = Service() driver = webdriver.Chrome(service=service) try: # Set page load timeout to 10 seconds ...

Read More

Wait until page is loaded with Selenium WebDriver for Python.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 25-Mar-2026 2K+ Views

We can wait until the page is loaded with Selenium WebDriver using synchronization concepts. Selenium provides implicit and explicit wait mechanisms. To wait until the page is loaded, we use the explicit wait approach. The explicit wait depends on expected conditions for particular element behaviors. For waiting until the page loads, we use expected conditions like presence_of_element_located for a specific element. If the wait time elapses without the condition being met, a timeout error is thrown. Required Imports To implement explicit wait conditions, we need the WebDriverWait and expected_conditions classes ? from selenium import webdriver ...

Read More

Moving mouse pointer to a specific location or element using C# and Selenium

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 17-Mar-2026 7K+ Views

We can move mouse pointer to a specific location or element in Selenium WebDriver with C# using the Actions class. This class provides methods to simulate user interactions like moving the mouse, clicking, and performing complex gestures on web elements. To move the mouse to an element, we use the MoveToElement method and pass the element locator as a parameter. To move to specific coordinates, we use the MoveByOffset method. All actions must be executed using the Perform method. Syntax Following is the syntax for creating an Actions object and moving to an element − ...

Read More

How to open a browser window in full screen using Selenium WebDriver with C#?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 17-Mar-2026 2K+ Views

We can open a browser window in full screen using Selenium WebDriver in C# by using the Maximize() method. This method is applied on the WebDriver object through the window management interface and expands the browser to fill the entire screen. Syntax Following is the syntax for maximizing a browser window − driver.Manage().Window.Maximize(); For setting specific window size, you can also use − driver.Manage().Window.Size = new Size(width, height); Using Maximize() Method The Maximize() method is the most common approach to open a browser in full screen mode. It automatically ...

Read More

Accessing HTML source code using Python Selenium.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 16-Mar-2026 4K+ Views

We can access HTML source code with Selenium WebDriver using two primary methods. The page_source method retrieves the complete HTML of the current page, while JavaScript execution allows us to access specific portions of the DOM, such as the body content. Syntax Following is the syntax for accessing HTML source using the page_source method − src = driver.page_source Following is the syntax for accessing HTML source using JavaScript execution − h = driver.execute_script("return document.body.innerHTML") Method 1: Using page_source Method The page_source method returns the complete HTML source code of ...

Read More

How to set style display of an html element in a selenium test?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 16-Mar-2026 3K+ Views

We can set the style display of an HTML element with Selenium WebDriver using JavaScript execution. The DOM interacts with page elements through JavaScript, and Selenium executes JavaScript commands using the executeScript method. This approach is particularly useful when you need to modify CSS properties like visibility, display type, or other styling attributes programmatically during test execution. Some operations like setting the style display must be performed by JavaScript Executor. The getElementById method locates the element, then we apply the style.display property to set the display type such as block, none, inline, or flex. Syntax Following is ...

Read More

How to simulate pressing enter in html text input with Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 16-Mar-2026 852 Views

We can simulate pressing enter in HTML text input fields using Selenium WebDriver. The sendKeys method allows us to send key presses to web elements, including the Enter key. This is commonly used for form submissions, search operations, or triggering input validation. Syntax Following is the syntax to simulate pressing Enter using Selenium − element.sendKeys(Keys.ENTER); Alternatively, you can use Keys.RETURN which produces the same result − element.sendKeys(Keys.RETURN); Both Keys.ENTER and Keys.RETURN represent the same key press action and can be used interchangeably in Selenium automation. Required Import To ...

Read More
Showing 11–20 of 362 articles
« Prev 1 2 3 4 5 37 Next »
Advertisements