How do you automatically open the Chrome Devtools within Selenium (VB.NET)?

This is how i open it

RUN < CMD

cd C:\Program Files\Google\Chrome\Application

chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\API\localhost"

My VB.NET Code Its not working

Dim options = New ChromeOptions()
        options.AddArgument("--start-maximized")
        options.AddArguments("disable-infobars")
        options.AddArguments("--disable-notifications")
        options.AddAdditionalCapability("debuggerAddress", "localhost:9222")
        Dim driver = New ChromeDriver("C:\API\chromedriver.exe", options)
        driver.get("https://ipleak.net/")

Tested with python it's working but i want it for VB.NET

Python Code: 
from selenium import webdriver
import time
from selenium.webdriver.support.ui import WebDriverWait
from selenium import webdriver
from selenium.webdriver.chrome.options import Options



# configure chrome options
option = Options()
option.add_experimental_option("debuggerAddress","localhost:9222")
driver = webdriver.Chrome(executable_path = "C:\API\chromedriver.exe",options=option)

# open website
driver.get("https://ipleak.net/")

Update # Reply to @Villa_7

I tried this. not worked for some reason i think "PATH" code is wrong

 Dim options = New ChromeOptions()
        options.AddArguments("--auto-open-devtools-for-tabs")
        Dim driver = New ChromeDriver("C:\API\chromedriver.exe",options)
        driver.Navigate().GoToUrl("https://ipleak.net")

Selenium does not run when i set it as PATH :

Dim driver = New ChromeDriver("C:\API\chromedriver.exe", options)

It only run when i make it like this :

Dim driver As IWebDriver = New ChromeDriver(options)

1 answer

  • answered 2021-09-22 14:43 Villa_7

    Try this snippet:

    Dim options = New ChromeOptions()
    options.AddArguments("--auto-open-devtools-for-tabs")
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum