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:
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!
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!
6 Answers, 1 is accepted
0
Stephen
Top achievements
Rank 1
answered on 24 Feb 2014, 06:18 PM
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
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
0
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
@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
Test Studio Trainings
0
Stephen
Top achievements
Rank 1
answered on 25 Feb 2014, 04:43 PM
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
0
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
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
Test Studio Trainings
0
James
Top achievements
Rank 1
answered on 28 Feb 2014, 10:00 PM
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?
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?
0
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
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
Test Studio Trainings