WebdriverIo testrunner closes the browser after finishing the test. Is there a way to change this default option?
You could throw a browser.debug() at the end of your test, which will pause test execution until you exit out of it.
Related
I would like to run separate protractor specs without closing the browser in between.
Something like:
Open the browser and go to the URL
then, run "protractor conf.js --specs=spec1.js"
then, do some actions on the SUT, typically do some actions on our simulator (so, non protractor actions)
then, run "protractor conf.js --specs=spec2.js"
and finally close the browser and shutdown the webdriver.
The goal is to keep the context between the protractor specs execution.
Is it possible?
Correction and Additional information:
My need is to keep the browser opened between two separate test suites (in separate files) and not between two tests.
I'm using IE11 alongside selenium standalone server.
Thank you.
Protractor by default doesnt close the browser between each session unless you specifically ask it do so. The below option in config file controls that.
/** * If true, protractor will restart the browser between each
test. Default * value is false. * * CAUTION: This will cause
your tests to slow down drastically. */
restartBrowserBetweenTests?: boolean;
Looks like your requirement is
Execute Spec 1
Execute some task outside browser(non-protractor work)
Then Execute Spec 2
Normally how I implement this is - lets say I have a task to validate & confirm email from my outlook , which is a non-protractor task before I run next test case, I just throw an alert at the end of my 1st test case asking the tester to manually verify the email and then accept the alert on the browser and then I will proceed with the second test case
I have been poking around quite a bit trying to solve this. This test case
https://github.com/deanhiller/webpieces/blob/master/webserver/projecttemplates/templateProject/TEMPLATEAPPNAME-prod/src/test/java/PACKAGE/WithSeleniumTest.java
hangs in gradle but not in eclipse. Basically, clone the project and "./gradlew test" hangs.
I am going to research debug mode for unit tests but not sure that gets me very far from the posts I have been reading like
https://discuss.gradle.org/t/help-my-gradle-script-hangs-during-build-at-end-of-tests/7505/15
So I ran the specific test in debug mode
./gradlew -Dtest.single=WithSeleniumTest :webserver:projecttemplates:templateProject:TEMPLATEAPPNAME-prod:test --debujvm
And it definitely got all the way to class teardown calling driver.quit() but then just hung for some reason :(.
ouch....I was calling driver.quit() but actually had to call
driver.close()
driver.quit()
and now it doesn't hang!!!!
ugh...why two method calls.
I'd like to stop or pause Selenium test when running with playframework, because I can't see what is wrong!
Is there a way to preserve the window with my application on the step where it failed? It automatically closes that window!
You could try a few things after you pin point exactly which step causes the error:
Put a wait command in your selenium test to pause the test so you can see what is going on in the UI
You could start the debugger and put a break point on some code that gets executed on the server after the failure happens (assuming the test continues running after the failure)
You could use the selenium test runner panel to slow down the speed of the test so you can see the error (i.e. I'm referring to the speed slider that you see when you run the tests in the browser via the url http://localhost:9000/#tests)
I have a set of tests that I've developed using the Selenium IDE in Firefox. Tests run fine and all pass. Now I'm trying to port those over to C# and run the tests for IE using MSTest and selenium-server. Here's the sequence of events:
Run all tests on Firefox via Selenium IDE. All tests pass.
Export tests to MSTest (Nunit export, rename some stuff etc.)
Start selenium-server-1.0.3
Run the tests in VS2008. Selenium setup is: selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://localhost/theSite/");; note that I can browse to http://localhost/theSite/ just fine.
4a. Confirm test is launching Firefox. Got result:
17:00:30.290 INFO - Preparing Firefox profile...
17:00:33.842 INFO - Launching Firefox...
First test ( waitForText "Login" in control "ctl00_TopNavBar_LoginStatus1") fails. Can't find the control.
if ("Login" == selenium.GetText("id=ctl00_TopNavBar_LoginStatus1")) break;
or
if ("Login" == selenium.GetText("ctl00_TopNavBar_LoginStatus1")) break;
All other tests fail as well -- same reason. Each test has a waitForText at the top.
Tried running the test in *chrome, *iexploreproxy and *firefox. All fail for the same reason.
Tried dumping a screenshot using selenium.CaptureEntirePageScreenshot("c:\\temp\\screenshots\\seleniumSite.png", "background=#FFFFFF"); and the screenshot is just a white bar.
So, my question is, how do I go about debugging this and figuring out what the real problem is? Clearly the page will render and the tests will pass. It's just when I try those tests in Selenium-RC that it fails so badly. Does the Selenium IDE have some bugs related to exporting tests to C#? (I have noticed one bug).
Are you executing selenium.Start() and selenium.Open()? Do you see the page opened in the browser?
Full initialization should be something similar to:
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://localhost/");
selenium.Start();
selenium.Open("/theSite/");
Important Note! test your IDE tests by starting with an empty page. Also, when using the IDE, if a command only has one parameter put it in the Target field, even if it isn't a control name.
Hi have problem i create test when i run it from selenium IDE everything is ok, test be passed. When i run my test by selenium testRunner the page was opened but any command eg. clickandwait cannot run in log error "Illegal operation on WrappedNative prototype object". Any idea?
There's an issue for this in their bug tracker:
http://code.google.com/p/selenium/issues/detail?id=703