HOW TO OPEN SELENIUM WINDOW WITH SELECTORSHUB

Sanjay Kumar
1 min readMay 5, 2021

--

How to open Selenium Browser Window with SelectorsHub

To open the automated browser window with SelectorsHub follow these steps-

1. Copy the SelectorsHub chrome store url.

https://chrome.google.com/webstore/detail/selectorshub/ndgimibanhlabgdgjcpbbndiehljcpfh/

2. Open a new tab with url http://crxextractor.com/ and click on ‘Start for Free’ then paste the SelectorsHub chrome store url given in step1 into the textfield. Click on download the crx to your local.

3. Now add the below lines of code into your script before initiating the WebDriver instance in your script:

ChromeOptions options = new ChromeOptions();

options.addExtensions(new File(“path of the crx extension on your local machine”));

driver = new ChromeDriver(options);

5. That’s all. SelectorsHub extension is now enabled in automated browser window. Just put a Thread.sleep at the point where you want your script to pause and inspect the element using SelectorsHub in Selenium browser window.

Sample code-
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.JavascriptExecutor;
import java.io.File;

public class OpenWindowWithSH {
public static WebDriver driver;
public static void main(String[] args) throws Exception {
System.setProperty(“webdriver.chrome.driver”, “/Users/sanjaykumar/Documents/chromedriver”);

ChromeOptions options = new ChromeOptions();

options.addExtensions(new File(“/Users/sanjaykumar/Downloads/extension_3_0_9_0.crx”));

WebDriver driver = new ChromeDriver(options);
driver.get(“http://selectorshub.com/”);
}
}

Watch the video tutorial here to open browser window with SelectorsHub through Selenium-

--

--

Sanjay Kumar
Sanjay Kumar

Written by Sanjay Kumar

Founder and Creator of SelectorsHub, TestCase Studio, TestCaseHub & ChroPath | Speaker | Blogger | Automation Passionate

No responses yet