Cannot LaunchNewBrowser Chrome with waitForBrowserToConnect = False

7 posts, 0 answers
  1. James
    James avatar
    8 posts
    Member since:
    Feb 2014

    Posted 19 Feb 2014 Link to this post

    This is closely related to my previous post http://www.telerik.com/forums/cannot-launchnewbrowser-chrome-as-minimized-window but I decided to post it as a new thread since this is a separate issue and it may help others to search for it easier. I am trying to launch a new chrome window with the waitForBrowserToConnect = false but I am getting the following error:

    InvalidOperationException - Sequence contains no elements

    Here is some sample code. It should be noted that the following code works perfect without an error if you change the browser from Chrome to Internet Explorer:

    Dim oSettings As Settings = New Settings()
     
    oSettings.Web.DefaultBrowser = BrowserType.Chrome
     
    Dim oManager As Manager = New Manager(oSettings)
     
    oManager.Start()
     
    Try
        oManager.LaunchNewBrowser(oSettings.Web.DefaultBrowser, False)
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

    The only reason I am trying to do this is so that I don't have to wait a few seconds for the automation controls to "connect". This way I can use pinvoke to minimize the chrome window quickly so that I only see it for a split second, but I can't because it crashes my app! Please help!
  2. Stephen
    Stephen avatar
    23 posts
    Member since:
    Feb 2014

    Posted 24 Feb 2014 in reply to James Link to this post

    HI James,

    I am experiencing the same problem, except for me it does not work foe IE or Chrome.  I would be interested to know if you have a solution or workaround.

    Thanks,
    Steve
  3. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 24 Feb 2014 Link to this post

    Hello,

    @James - in what way is it crashing your app? Are you talking about your web app or some other kind of application? In the LaunchNewBrowser call i'd like you to try this and let me know if that helps:

    oManager.LaunchNewBrowser(oManager.Settings.Web.DefaultBrowser, False, ProcessWindowStyle.Minimized)

    @Steve - are you also calling LaunchNewBrowser with the same parameter? Does the above suggest help?



    Regards,
    Cody
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  4. Stephen
    Stephen avatar
    23 posts
    Member since:
    Feb 2014

    Posted 25 Feb 2014 in reply to Cody Link to this post

    Yes I am using LaunchNewBrowser. I tried the following but it did not help:

    myManager.LaunchNewBrowser(myManager.Settings.Web.DefaultBrowser, false, ProcessWindowStyle.Minimized);

    I also check that the "Platform Target" is set to x86 but that also did not help (I am still getting the "Sequence contains no elements" exception).

    Thanks,
    Steve

  5. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 27 Feb 2014 Link to this post

    Hi Steve,

    I just verified the same code works perfectly on my Win 7 64-bit machine with IE 9. What OS are you running? Are you running in a VM?

    Regards,
    Cody
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  6. James
    James avatar
    8 posts
    Member since:
    Feb 2014

    Posted 28 Feb 2014 in reply to Cody Link to this post

    Hi Cody,

    I have this code running in visual studio 2012 in a VB.net windows forms application (.net Framework 4). As I mentioned in my original post, the code works fine with Internet explorer (IE 11), but it crashes the application if I try to use chrome. This is not a VM but my main computer running Windows xp pro 64-bit. The target cpu is set to x86 if that matters. I tried your sample code but it gives the same error. I launched visual studio as administrator and then loaded my project so I know I have full admin rights.

    Can you verify that the same code works perfectly on your Win 7 64-bit machine with Chrome?
  7. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 05 Mar 2014 Link to this post

    Hello James,

    I discovered that:
    oManager.LaunchNewBrowser(oManager.Settings.Web.DefaultBrowser, False, ProcessWindowStyle.Minimized)

    Only works with IE. Due to the way we connect to the other browsers, using False for the second parameter simply cannot work.

    Regards,
    Cody
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top