Advanced Selenium Interview Questions and Answers

HOME

Number of Tests * Average Test Time / Number of Nodes = Total Execution Time
 
15      *       45s        /        1        =      11m 15s   // Without Grid
15      *       45s        /        5        =      2m 15s    // Grid with 5 Nodes
15      *       45s        /        15       =      45s       // Grid with 15 Nodes

To know more about the steps to configure Selenium4, please refer to Selenium 4 Grid – Parallel Testing.

(//parentElement/*)[n]

import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
 
public class ProxyDemo {
 
    public static void main(String[] args) {
 
        // Set the proxy server details
        String proxyAddress = "localhost";
        int proxyPort = 8080;
 
        // Create a Proxy object and set the HTTP proxy details
        Proxy proxy = new Proxy();
        proxy.setHttpProxy(proxyAddress + ":" + proxyPort);
 
        // Configure Chrome options with the Proxy object
        ChromeOptions options = new ChromeOptions();
        options.setProxy(proxy);
        options.addArguments("start-maximized");
 
        // Instantiate ChromeDriver with the configured options
        WebDriver driver = new ChromeDriver(options);
 
 
        // Perform your browsing actions using the driver
        driver.get("https://www.google.com");
        System.out.println("Page Title :" + driver.getTitle());
 
        // Close the browser session
        driver.quit();
    }
}

WebDriver driver = new ChromeDriver(); // For Chrome

WebDriver driver = new FirefoxDriver(); // For Firefox

WebDriver driver = new EdgeDriver(); // For Edge

Leave a comment