I am using Selenium for chrome browser automation. I want to open a webpage and fill a login form , submit etc. Below is a part of code
Dim chromeOptions As New OpenQA.Selenium.Chrome.ChromeOptions()
chromeOptions.AddExcludedArgument("ignore-certifcate-errors")
chromeOptions.AddArgument("test-type")
Dim driver As IWebDriver = New ChromeDriver(chromeOptions)
driver.Navigate().GoToUrl("https://example.com")
Dim myLink1 As IWebElement = driver.FindElement(By.Name("userName"))
myLink1.SendKeys("username")
Dim myLink2 As IWebElement = driver.FindElement(By.Name("password"))
myLink2.SendKeys("mypassword")
It works properly. But when i run the application a console window appears when chrome gets open. It is due to chromedriver.exe And cond=sole windows shows "Starting ChromeDriver (v2.9.248315) on port 2078". But I don't want this console window to appear as user suing application will not require it and understand what it is.So is there any way to avoid this console window?
Also how can I get page complete events once the page gets loaded completely?
EDIT
Like in Document complete which is available for web browser controls. After reading selenium documentation I found that there exists a EventFiringWebDriver which may do what I want(like OnNavigated ) And chromeDriver does not have these. But i didnt get any example of how it(EventFiringWebDriver ) can be used with Onnavigated functions etc to get these events.
EDIT
What I did is
Imports OpenQA.Selenium
Imports OpenQA.Selenium.Chrome
Imports OpenQA.Selenium.Support.Events
Dim service As ChromeDriverService = ChromeDriverService.CreateDefaultService
Dim driver1 As ChromeDriver = Nothing
Dim driver As EventFiringWebDriver
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim chromeOptions As New OpenQA.Selenium.Chrome.ChromeOptions()
chromeOptions.AddExcludedArgument("ignore-certifcate-errors")
chromeOptions.AddArgument("test-type")
service.HideCommandPromptWindow = True
driver1 = New ChromeDriver(service, chromeOptions)
driver = New EventFiringWebDriver(driver1)
AddHandler driver.Navigated, AddressOf OnNavigated
driver.Navigate().GoToUrl("https://example.com")
Dim myLink1 As IWebElement = driver.FindElement(By.Name("userName"))
myLink1.SendKeys("username")
Dim myLink2 As IWebElement = driver.FindElement(By.Name("password"))
myLink2.SendKeys("mypassword")
End Sub
Protected Sub OnNavigated(ByVal sender As Object, ByVal e As Support.Events.WebDriverNavigationEventArgs)
MessageBox.Show("Page navaigated " & e.Url)
End Sub
End Class
After page gets navigated OnNavigated function triggered as I expected. But after page gets navigated and user name and password filled and if user clicks on login button manually a new page will appear after login. During this new page gets navigated it wont trigger OnNavigated .But i want to get notification for every page that gets navigated even from user inputs. So how this can be achieved?