Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

590 articles

Capturing JavaScript error in Selenium.

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

We can capture JavaScript errors in Selenium WebDriver to identify console errors that appear in the browser's Developer Tools. These errors can occur due to functional issues on the page or performance problems caused by excessive logging. JavaScript errors are typically visible in the Console tab of browser Developer Tools and can impact application functionality. Selenium provides logging capabilities to capture and analyze these errors programmatically. Browser Developer Tools - Console Tab ...

Read More

Wait for complex page with JavaScript to load using Selenium.

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

We can wait for a complex page with JavaScript to load with Selenium. After the page is loaded, we can invoke the Javascript method document.readyState and wait till complete is returned. Understanding document.readyState The document.readyState property returns the loading status of the document. It has three possible values: loading - The document is still loading interactive - Document has finished loading but sub-resources may still be loading complete - The document and all sub-resources have finished loading Syntax JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("return document.readyState").toString().equals("complete"); Method 1: Using document.readyState Check ...

Read More

Getting the return value of Javascript code in Selenium.

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

We can get the return value of Javascript code with Selenium WebDriver using the executeScript method. This method executes JavaScript commands in the browser and can return values back to our Java code. To work with JavaScript in Selenium, we need to cast our WebDriver instance to JavascriptExecutor and import the necessary package. The JavaScript command is passed as a string argument to the executeScript method. Syntax JavascriptExecutor js = (JavascriptExecutor) driver; Object result = js.executeScript("return document.getElementById('elementId').value"); Key Points When working with JavaScript return values in Selenium: Use the return keyword ...

Read More

Reading JavaScript variables using Selenium WebDriver.

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

We can read JavaScript variables with Selenium WebDriver using the executeScript method. This method allows Selenium to execute JavaScript commands directly in the browser and return their results. To work with JavaScript in Selenium, we need to import org.openqa.selenium.JavascriptExecutor. Syntax JavascriptExecutor j = (JavascriptExecutor) driver; String result = (String) j.executeScript("return document.title"); Reading Document Properties The most common use case is reading document properties like title, URL, or DOM elements. Let's obtain the browser title by reading the JavaScript variable document.title. Example Here's a complete example that reads the page title ...

Read More

WebDriver click() vs JavaScript click().

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Mar-2026 824 Views

In Selenium WebDriver, there are two primary methods to click elements: the standard WebDriver click() method and JavaScript click() through JavaScriptExecutor. Each approach has distinct advantages and use cases. WebDriver click() Method The standard WebDriver click() simulates actual user interaction. It waits for the element to be visible and clickable before performing the action. This method works with various locators including link text and partial link text. WebDriver click() Browser Engine ...

Read More

How to get the value of the edit box in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Mar-2026 641 Views

In Selenium WebDriver, retrieving values from edit boxes (input fields) requires specific methods since getText() often returns empty strings for input elements. Here are the most effective approaches to extract values from edit boxes. Why getText() May Not Work The getText() method retrieves visible text content, but input fields store their values in the "value" attribute rather than as text content. This is why getText() often returns empty strings for input elements. Method 1: Using getAttribute("value") The most reliable approach is using the getAttribute() method to retrieve the "value" attribute: import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; ...

Read More

Among id, name, xpath and css, which locator should be used?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Mar-2026 428 Views

When selecting locators for web automation, the choice depends on element uniqueness, performance requirements, and traversal needs. Here's a comprehensive guide to choosing the right locator strategy. Locator Priority Order The recommended priority order for locator selection: Priority Locator Reason 1 id Fastest, most reliable if unique 2 name Fast, good for form elements 3 CSS Selector Fast, flexible, good performance 4 XPath Most flexible but slower When to Use Each Locator ID Locator Use when elements have unique IDs. This is the ...

Read More

How to identify the nth sub element using xpath?

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

We can identify the nth sub element using xpath in the following ways: By adding square brackets with index. By using position() method in xpath. Method 1: Using Square Brackets with Index The most common approach is to add square brackets with the desired index number after the element selector: // Select the 2nd div element //div[2] // Select the 3rd li element inside ul //ul/li[3] // Select the first input with type='text' //input[@type='text'][1] Method 2: Using position() Function The position() function provides another way to target elements ...

Read More

What does fluent wait perform?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Mar-2026 584 Views

Fluent wait is a dynamic wait mechanism in Selenium that allows the WebDriver to pause and repeatedly check for a condition at regular intervals before throwing an exception. Unlike implicit wait, FluentWait provides more control over polling frequency and exception handling. How FluentWait Works FluentWait monitors the DOM at regular intervals (defined by polling frequency) rather than constantly checking. For example, if you set a 30-second timeout with 3-second polling, the driver will check the condition every 3 seconds for up to 30 seconds before timing out. Syntax Wait wait = new FluentWait(driver) ...

Read More

Explain Keyword driven framework.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Mar-2026 391 Views

Keyword driven framework is also known as table driven framework. Here we have a table where we describe the keywords or actions for the methods that have to be executed. Automation test scripts are developed based on the keywords or actions mentioned in excel. The automation testers need to extend the framework capabilities by updating or building newer keywords. Framework Structure People working on manual testing with lesser programming knowledge can use this framework. The main idea is to identify the keywords or actions and utilize them in excel maintained for that particular test scenario. Often this ...

Read More
Showing 1–10 of 590 articles
« Prev 1 2 3 4 5 59 Next »
Advertisements