Forum Discussion
Let's say you have added the test object "SeleniumTests" to your test project. In there, you have your assembly and you've specified your TestFixture. I haven't tried this, but apparently, when you add your test fixture, you do have the option to specific parameters. So, somewhere in there, there's a parameter call to execute the test fixture.
Give this a try. Where your object is called "SeleniumTests" and the NUnit test you've added you've called "TestFixture", will this script code work?
function testAllBrowsers(){ for (var i = 0; i < Browsers.Count; i++) { SeleniumTests.TestFixture.Execute(Browsers.Item(i).Family); } }
Or... perhaps if there are parameters that need to be set you would have to do something like
function testAllBrowsers(){ for (var i = 0; i < Browsers.Count; i++) { SeleniumTests.TestFixture.BrowserName = Browsers.Item(i).Family; SeleniumTests.TestFixture.Execute(); } }
Some things worth exploring, I guess... I haven't done much with the Selenium interfacing but something on these lines probably exists SOMEWHERE.
- bgran058 years agoOccasional Contributor
Thank you so much for your quick response. I am not 100% sure yet where to put that function. I think I need to learn TestComplete itself a bit more.
I did try making a keyword test like this:
Browser Loop: Chrome, Edge
Run Code Snippet: Value = UnitTesting.SeleniumTests.Execute(Browsers.CurrentBrowser)
What this does is launches the browser (Chrome is the first), then it tries to run my test. My web drivers in the test not able to pick up that browser from the loop. I will keep taking a look at this.
- AlexKaras8 years agoChampion Level 3
Hi,
Selenium driver can use only the browser that it (driver) started. Selenium driver cannot attach to the already running browser. This is one of Selenium's essentials and I am really doubting this ever will be changed.
So, the only option you have, is to store browser's name in some configuration file written from TestComplete, read the name from this file in your Selenium test and proceed accordingly.
- tristaanogre8 years agoEsteemed Contributor
Try instead
Run Code Snippet: Value = UnitTesting.SeleniumTests.Execute(Browsers.Current
Browser.Family) You MIGHT need to modify your test fixture in selenium to recognize a different string. But that might work.
Just as a side note... you probably don't need to use a Code Snippet. You can use the Call Object Method operation... the object to use is UnitTesting.SeleniumTests, your method is "Execute", and if it has parameters, then you can set those in the next screen in the wizard. If it works as a code snippet, then you don't HAVE to change it, just pointing out a different way of doing the same thing without having to write a code snippet.
Related Content
Recent Discussions
- 12 hours agosimonaferrara
- 21 hours agoSubhraDas