Results 1 to 6 of 6

Thread: [RESOLVED] Selenium and Edge

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    528

    Resolved [RESOLVED] Selenium and Edge

    I'm trying to use Selenium to automate my login to the Morningstar website using the Microsoft Edge browser. This is my first time working with Selenium.

    I've added the following project references:

    WebDriver
    WebDriver.Support

    I've imported the following namespaces:

    OpenQA
    OpenQA.Selenium
    OpenQA.Selenium.Edge
    OpenQA.Selenium.Support.UI

    Here's a code snippet.

    Code:
    Imports OpenQA
    Imports OpenQA.Selenium
    Imports OpenQA.Selenium.Edge
    Imports OpenQA.Selenium.Support.UI
    Code:
        Sub Main()
    
            Dim driver As EdgeDriver
            Dim myElement As EdgeWebElement
            Dim strURL As String = ""
            Dim strUN As String = ""
            Dim strPW As String = ""
    
            strURL = "https://members.morningstar.com/memberservice/login.aspx"
            strUN = "MyUserName"
            strPW = "MyPassword"
    
            Try
                driver = New EdgeDriver
                driver.Navigate.GoToUrl(strURL)
    
                myElement = GetWebElement(driver, By.Id("uim-uEmail-input"), 10)
                myElement.SendKeys(strUN)
    
                myElement = GetWebElement(driver, By.Id("uim-uPassword-input"), 10)
                myElement.SendKeys(strPW)
    
                myElement = GetWebElement(driver, By.Id("remember_me"), 10)
                myElement.Click()
    
                myElement = GetWebElement(driver, By.Id("uim-login-submit"), 10)
                myElement.Click()
    
            Catch ex As WebDriverException
    
            Catch ex As Exception
    
            End Try
    
        End Sub
    A WebDriverException is raised when the "driver = New EdgeDriver" line executes (a blank Edge page opens).

    I'd appreciate any advice for how to resolve this error.

    Thanks.
    Last edited by Mark@SF; Apr 13th, 2019 at 08:47 PM.

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Selenium and Edge

    Well, you've defined the imports. Have you added a reference to the library in your project?
    From the Project menu, Add Reference.
    Last edited by passel; Apr 13th, 2019 at 02:28 PM.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    528

    Re: Selenium and Edge

    Hi passel -

    Yes, here's my Reference list:

    Name:  2019-04-13_12-58-13.jpg
Views: 1456
Size:  22.5 KB

    I've added the WebDriver and WebDriver.Support references.

    I also added the MicrosoftWebDriver.exe file to the project.

    Name:  2019-04-13_14-13-00.jpg
Views: 1503
Size:  17.2 KB

    The WebDriverException.InnerException message is:

    Code:
    The underlying connection was closed: An unexpected error occurred on a receive.
    What am I missing?
    Last edited by Mark@SF; Apr 13th, 2019 at 04:14 PM.

  4. #4
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Selenium and Edge

    OK. Well, I don't know anything about it.
    It doesn't appear to be a reference problem any longer.
    From the text of the exception, it sounds like it might be some kind of handshake issue, i.e. you contacted the website, there was some response, and the reception failed in some manner on your end. I could be completely off base, so take it with a grain of salt.
    I have no experience with it.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    528

    Re: Selenium and Edge

    I've figured it out. The Selenium WebDriver that I was using was not the correct release for my Edge browser version.

    I had downloaded Release 17134 from the Microsoft Developer website (https://developer.microsoft.com/en-u...ols/webdriver/).

    When I checked my Edge browser, I discovered that it is version 18.17763 (not 17134).

    Name:  2019-04-13_15-33-14.jpg
Views: 1459
Size:  73.5 KB

    After a lot of Googling, I came across this:

    https://developer.microsoft.com/en-u...sues/20144497/

    The driver is now distributed as part of the OS, and as such, should always be in sync with the browser. You will no longer need to download a standalone executable, just make sure the feature of the OS is installed.

    Settings - apps - manage optional features - add a feature - Microsoft Webdriver
    So, via the Windows Settings (see above) I added the Microsoft WebDriver optional feature.

    Voila! My code works and I can now automatically login to the Morningstar website.
    Last edited by Mark@SF; Apr 13th, 2019 at 06:12 PM.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    528

    Re: Selenium and Edge

    Is it possible to start the Edge browser as a hidden window and once the login has completed, show the window?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width