I've tried various methods in C# but I can't seem to get them working in VB.NET. It's possible that I'm not initializing it correctly. My goal is to run javascript on a loaded URL using the chromedriver.
This is what my code looks like:
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');")
The script isn't running. Any assistance would be greatly appreciated! :)