Selenium & C# - run test cases sequentially for all browsers - selenium

I am using Selenium (WebDriver) and C# and have a question regarding running tests.
I have developed a number of tests and they are all working as I expect. I am able to execute them in FireFox, IE and Chrome but I have to manually alter the definition of my driver initialization between runs.
What I want is to run all tests in IE, then re-execute in Chrome then once more in FireFox and I have not figured out how I could do that.
Anyone done something similar?
Any thoughts are appreciated.
Thanks
Sean

Related

Chrome browser stuck when executed Selenium tests in parallel

When I run Selenium tests on Chrome in parallel with two threads(both threads running on same machine), sometimes I've seen one of the chrome instances stuck(i.e UI interactions do not happen) for some time or indefinitely.
This causes test execution to take more time or fail test unnecessarily.
Could you please help to understand if this is known behaviour when tests run on same machine? If not, what are the causes and solutions? Also guide on how we can pro-grammatically(using Java) set memory for Chrome browser which is running through Selenium?

FireFox still not working for Protractor/Selenium tests?

I have a project suite of automation tests that uses Protractor and Jasmine. As of a couple months ago, my tests stopped working in FireFox. Everything works perfectly in Chrome, and almost perfectly in IE.. because why would IE work ya know.
There have been multiple posts about this and I've read through all of them, but I haven't been able to determine if there's a workaround/solution to this. It's not entirely a HUGE deal if my tests run in FireFox, but with a web application it's mighty nice to be able to test all instances.
Basically what happens when I run a test in FireFox:
Command prompt acts like everything is about to run properly (FireFox driver starts up.. server remains running etc etc)
Firefox opens for a split second (icon appears on the task bar, browser flashes on the screen and closes)
After a good minute or so protractor gives me the following message:
[firefox #01-0] WebDriverError: Unable to connect to host XXX on port XXX
after 45000 ms.
With a ton of DEBUG lines referring to JSON files and Firefox addons.
Any thoughts or other sources I could check out would be sweet. Many thanks in advance.
Problem is with latest Firefox support from latest selenium-server. Use geckoDriver and it will work.
Follow this URL

How to clear session using selenium and phantomJS

I have a series of automated tests that use selenium, specifically Geb with Spock. When I run all my tests cases one after another using a chromedriver, my tests run fine. Each test method gets a new session and therefore start with a fresh browser each time. This is not the case when using phantomJS. If a test method happens to fail when using phantomJS, all following test cases will fail because the session was not reset. I can see this happening because the screenshots taken at the end of each test method.
I have tried researching this issue and have discovered it has been a known issue for a couple of years now. Some say it was fixed in phantomjs 2.1 but I'm currently using version 2.1.1, which is the most recent version.
I have also tried using driver.manage().deleteAllCookies(); with no luck, as other threads have mentioned.
Is there a workaround anyone is aware of?
have you tried webdriver's quit method?

How to disable firefox from opening while running test suite in Selenium IDE?

I am writing test scripts in Selenium IDE for my application but everytime when I run the test suite it opens up browser and performs all the actions and logs failures, if any. My requirement is to invoke the test script from command prompt using .bat file and generate a test report. I am able to do the same but the problem is firefox opens up and executes the test case one by one. Can anyone please suggest me how to disable Firefox window from opening up? Or is it just not possible to do so? Or do I need to switch to Selenium Webdriver in order to achieve my requirement? My application contains Ajax upto a lot of extent.
I have read many commands used in Selenium IDE but I could not find any command which can serve this purpose. Please suggest!
If you know any programming language supported by selenium-webdriver (Ruby, Java, Python, C#) then you should try PhantomJS WebDriver which allow to run scripts without opening visual browser session
Selenium-IDE are mean to invoke browser, that's how the script react to all the exact browser behavior.
Only selenium Webdriver allow you to run your browser under "Headless" mode, which in fact, put Firefox under X-virtual frame buffer in background, as above #Andersson suggested.
Unfortunately, there is no easy way to convert your Selenium-IDE script to your desire programming language at the moment.
If your concern is about "cluttered screen" in OS such as ubuntu, then your solution will be export the whole Selenium-IDE and firefox under another virtual X-display.

Selenium Junits on headless browser

I have recorded scripts through Selenium IDE and converted them to JUnit 4 Webdriver scripts.
Of course converted scripts had to be changed to run smoothly as Junits. Now my next goal is to make these scripts run on CI, So obviously I need some headless browser for this purpose. I found some threads, but I am looking for Junits specifically.
What could be the best solution/approach for this, any help in this regard is appreciated.
Take a look at PhantomJS. It is a headless WebKit-based browser and there is Selenium WebDriver for that called GhostDriver.
That's what i use and is OK but there is also the option of using a headed browser like Firefox or Chrome and then use Xvfb to ignore screen output.