I've seen numerous solutions for C# but I couldn't get it working in VB.NET. Maybe I am initalizing it wrong? I'd like to execute javascript over a loaded URL in the chromedriver.
My code so far:
Dim chromeOptions As New OpenQA.Selenium.Chrome.ChromeOptions()
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.images", 2)
Dim driverService = ChromeDriverService.CreateDefaultService()
driverService.HideCommandPromptWindow = True
driver = New ChromeDriver(driverService, chromeOptions)
Dim js As IJavaScriptExecutor = TryCast(driver, IJavaScriptExecutor)
driver.Navigate.GoToUrl("https://www.google.com/")
js.ExecuteScript("alert('hello world');")
It's not executing. Any help, please? :)