We’ll walk you through a hands-on example that demonstrates how to programmatically select and unselect checkboxes using GenAI or ChatGPT, a task that forms the backbone of many web testing and automation projects. Our comprehensive guide covers everything from setting up your Selenium environment to crafting and dissecting the automation code. So, let’s dive in: ChatGPT or GenAI Prompt for […]
If you have recently upgraded to the latest ChromeDriver and are encountering the “java.io.IOException: Invalid Status code=403 text=Forbidden” error, while trying to initialize ChromeDriver, then there are a couple of ways to resolve it. Firstly, you can add dependencies and set properties to overcome this error. Add the following dependency to your project: <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-http-jdk-client</artifactId> <version>4.8.1</version> </dependency> Then, set […]
How to Handle Multiple Windows/Tabs in Selenium? Firstly, We will open three different tabs with different URLs and store unique identifier strings returned by the getWindowHandle() method in tab1, tab2, and tab3 string variables. Next, we will switch to Tab 2 using the driver.switchTo().window() method. We will then use the getWindowHandles() method to get the window handles and store them […]
This tutorial will briefly discuss the difference between getWindowHandle() and getWindowHandles() with a sample project. getWindowHandle() returns the window handle of the current or active window. getWindowHandles() returns a set of window handles for all the windows opened by the WebDriver instance. Example: package TestAutomationCentral; import org.openqa.selenium.WebDriver;import org.openqa.selenium.WindowType;import org.openqa.selenium.chrome.ChromeDriver; import java.util.Set; public class SeleniumWindowHandles { public static void main(String[] args) […]
In this tutorial, we will discuss on Difference between the close() and quit() methods in Selenium WebDriver ‘close()’ method closes the currently active/focus window or tab of the current browser instance. ‘quit()’ method closes all open windows or tabs of the current browser instance. Example: package TestAutomationCentral;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WindowType;import org.openqa.selenium.chrome.ChromeDriver;import org.openqa.selenium.chrome.ChromeOptions;public class CloseAndQuitDemo { public static void main(String[] args) throws […]
In this tutorial, we will discuss Running Selenium Tests in Headless Mode. Selenium WebDriver supports headless mode with different browsers like Chrome, Firefox, and Edge. Safari WebDriver does not support headless mode. What is the Headless mode in Selenium WebDriver? In headless mode, we can run Tests Without a GUI Why Headless mode and what are its advantages? Headless mode […]
This tutorial will guide you through the process of handling SSL Certificates in Selenium WebDriver for different browsers like Chrome, Firefox, Edge, and Safari in a step-by-step manner. List of SSL Certificates which we need to handle: Steps: Example package TestAutomationCentral;import org.openqa.selenium.WebDriver;import org.openqa.selenium.chrome.ChromeDriver;import org.openqa.selenium.chrome.ChromeOptions;public class SSLCertificate { public static void main(String[] args) { //TestAutomationCentral.com System.setProperty(“webdriver.chrome.driver”, “C:\\temp\\drivers\\chromedriver.exe”); ChromeOptions options = new […]
STEP 1: Initial min and max values and set them to 0int min = 0, max = 0; STEP 2: Use for loop to iterate each element in the array for (int i = 0; i < arr.length; i++) STEP 3: Within the loop, write if and else if conditions to compare the current element values and set min/max with […]
Selenium does not provide the built-in methods to highlight WebElements on the web page. However, we can overcome and highlight any WebElement using JavascriptExecutor. Code Snippet to highlight element with border: We can set any color to highlight the element with border sizes like 2px, and 5px and pass the values in JavascriptExecutor parameters. js.executeScript(“arguments[0].style.border=’2px solid black'”, element); js.executeScript(“arguments[0].style.border=’4px solid […]
Selenium WebDriver provides built-in functionality for managing the size of browser windows through its Window interface. The current browser window can be expanded to its maximum size using the maximise() function and it can be shrunk to its lowest size using the minimise() method. Maximize and Minimize methods The Selenium WebDriver library provides an interface called Window that provides the […]