Unable to execute script on CBT
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unable to execute script on CBT
In Crossbrowser testing when we are executing our script on (window10 and firefox65 (64 bit))
facing an error "Another browser is used."
for full details kindly check the attachment.
Also check below code, here in parameter BrowserName have chrome as per my test data and in CBT I am executing on firefox, I think this the problem.
Sub OpenBrowserWithURL (BrowserName,URL)
Dim firefox,InternetExplorer,Chrome,Edge
If (BrowserName="Firefox")Then
Browsers.Item("firefox").RunOptions = "-P ""Tester"""
Sys.Browser.BrowserWindow(0).Maximize
ElseIf (BrowserName="InternetExplorer")Then
Browsers.Item("iexplore", "11", Browsers.pX64).Run URL
Sys.Browser.BrowserWindow(0).Maximize
ElseIf (BrowserName="Edge")Then
Browsers.Item(btEdge).Navigate(URL)
Sys.Browser.BrowserWindow(0).Maximize
ElseIf (BrowserName="Chrome")Then
Browsers.Item(btChrome).Navigate(URL)
Sys.Browser("chrome").BrowserWindow(0).Maximize
Log.Checkpoint("Browser Name: "&BrowserName)
Log.Checkpoint("URL: "&URL)
End If
Browsers.Refresh
End Sub
- Labels:
-
Cross-Browser Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Each CBT environment is configured specifically for a combination of operating system and browser. Running a "chrome" test on a "firefox" environment is not supported. It won't work.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Exactly.. but this is the problem as we have to execute our script some times seprately and sometimes on CBT.
In that condition how can I execute my script on CBT.
Should I change browser in my test data according queue test items in CBT ?
What is the solution fo that. I am still looking for an answer.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to make sure you only attach Chrome tests to chrome environments and Firefox tests to Firefox environments. You can also write your code better to run only the browser that's on the environment.
This comes down to smarter code... only running what you need to run, when you run it, and on which environment you run it. In my experimentation with CBT, you explicitly attach tests to an environment and run them. So, you should design your tests for the environment and run only those on those environments.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
And, as a side note...
Your code and my comments in italics:
If (BrowserName="Firefox")Then
Browsers.Item("firefox").RunOptions = "-P ""Tester""" ' This does not start browser
Sys.Browser.BrowserWindow(0).Maximize ' This code will use any running browser (if any) because no browser was started explicitly
ElseIf (BrowserName="InternetExplorer")Then
Browsers.Item("iexplore", "11", Browsers.pX64).Run URL
Sys.Browser.BrowserWindow(0).Maximize ' same note as for FireFox
ElseIf (BrowserName="Edge")Then
Browsers.Item(btEdge).Navigate(URL) ' as per documentation, .Navigate() does not start the browser, so I'm doubting that this line will work
Sys.Browser.BrowserWindow(0).Maximize ' again, this does not guarantee that expected browser will be affected
ElseIf (BrowserName="Chrome")Then
Browsers.Item(btChrome).Navigate(URL)
Sys.Browser("chrome").BrowserWindow(0).Maximize
Log.Checkpoint("Browser Name: "&BrowserName) ' by definition, passed checkpoint means succeeded comparison/expected behavior. There is no verification either here or above. What is the reason to log succeeded checkpoint to test log?
Log.Checkpoint("URL: "&URL)
End If
Browsers.Refresh ' what is the reason to refresh the list of existing browsers if none of them was (re)installed?
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @AlexKaras ,
Thanks.. I got your point but I Stuck here as I do'nt know what should do exactly in the function.
Can you please tell me a bit the right way to start browser function. so it will execute successfully on CBT and normal execution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@kaiiii :
Hi,
OK, got it. 🙂
> Can you please tell me [...]
I wish I could... Really...
I tried CBT only when it was initially introduced in TestComplete several years ago. For TestComplete CBT supported only desktops with desktop browsers which I was not really interested at as I was looking for mobiles support. Thus I did not renew my trial CBT account. With the scalable web testing support introduced in TC 14.4 Beta I am thinking to try CBT one more time but still not sure as I think that scalable web still misses some important functionality which, I believe, will be implemented in version 14.5.
So I would recommend to investigate this yourself or ask CBT support. (And I will really appreciate it if you update this thread with the results.)
Right now I am tending to join Robert's explanation that with CBT you are getting only the browser that you requested. I am not sure whether or not it is started by default. Also I am not sure how to check if the test is running in the CBT environment or not. In the worst case you should be able to set some flag (Project Variable?) before starting tests in CBT.
I hope that you should be able to use Browsers object to find available browsers and, in combination with the above flag, start a proper browser.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Alex and Robert!
@kaiiii did you get the chance to contact the CBT support on this? As Alex mentiond, updates are greatly appreciated Thank you!
Sonya Mihaljova
Community and Education Specialist
