I am testing a complex web application using a test framework comprised of C#, Nunit 2.5.10 and Selenium RC 2.24.1 (Switching to WebDriver is not an option unfortunately).
We recently overhauled our application UI/UX, so we have been systematically updating our tests to fit the new version.
Everything has been pretty smooth until we ran into an issue where our browser seems to randomly crash when running certain tests. We use Firefox(Chrome Driver) for testing, but have various versions installed on our test clients from 3.6 to 15.01. The issue seems to be consistently reproducible on all browser versions running on Windows 7 and Windows Server 2008 R2.
When the browser crashes it leaves behind a dialog which remains even after we run our clean up method which kills any open browser sessions in preparation for the next tests. Because this dialog sticks around, it keeps an RC server session alive which causes the next set of tests to hang.
I traced the tests down to the specific actions which are causing the crash, and it seems to always be a click event, but on various buttons within the application, and not always the same one. The buttons have nothing in common except that they all trigger a javascript postback. I was also able to trace one crash to a postback event triggered by a drop down box selection.
Our test framework is fairly complex and we have thousands of tests, so we have resorted to commenting the crashing tests just to keep the rest of the suite running.
We have been unable to simulate the crash with manual testing, even when following the exact path taken by the selenium test.
Any thoughts on what might be causing this, or ways to troubleshoot it would be appreciated.
I've had issues with intermittent failure of Selenium tests caused by the real time protection on Microsoft Security Essentials. For me unchecking Turn on real-time protection in Settings | Real-time protection while I was running tests fixed the issue. Try disabling your anti virus while running tests and see if that solves your problem. Apparently the actions taken by Selenium can be interpreted as virus activity.
Related
Our Selenium tests were developed in C# and were running just fine for months but recently we noticed that a number of tests started failing when executed with Firefox WebDriver.
After investigating the test results and executing tests locally we noticed that from time to time clicks on random elements are executed (we can tell because the visual state of the button or the link changes to what looks like a clicked element)
Browser console does not indicated any errors. WebDriver logs show that click was executed.
Will be grateful for any help.
Edit:
Version of Selenium WebDriver - 2.53.0
Versions of Firefox - (tried few) 33.0.1, 43.0.1, 45.0, 46.0.1
Firefox scale 100%
tried with native events on and off
tried with additional implicit waiting before click
You question is not very specific, so I'll try to offer possible ways you can choose to resolving it.
You didn't indicate which driver and browser versions you used. If you didn't observe failures for months ant suddenly they appeared, my first guess would be that FF version you use on test machine(s) got updated (or driver version in tests was changed), and new combination can work differently. I had situation like this when tests behavior changed, updating driver version helped.
Another option would be to try and see which webelements get misclicked more often than others and insert instructions that check if they are displayed before executing actual click.
Also, try to do step-by-step debugging (if you haven't already) and see if you observe wrong clicks then
One thing we've seen in our testing is that if we're clicking around on the VM while a Selenium test is running on our VM, it can actually prevent clicks from going off.
But another thing we've encountered is that the clicks are often not working where they should be, so you can counter this by using JavaScript clicks instead of Selenium.
For elements that fail regularly, switch the element.Click() to a method utilizing the code below:
IJavaScriptExecutor executor = driver as IJavaScriptExecutor;
executor.ExecuteScript("arguments[0].click();", ElementToClick)
So the problem was that click does not work even when clicking manually so we'll be investigating in that direction.
i am automating using selenium webdriver and C#. Is there a way to capture all urls that my browser navigates to while my Selenium automation tests run using an external tool such as Fiddler core / wireshark. I mean while my tests continue to run, I would like some of these tools to capture my urls parallely so that incase my tests fail, i could investigate further by using the final few urls(from the point of failure) to debug the issue.
Is this really possible. Do I need to use a separate thread to one of these tools(Fiddler/wireshark/any other tool) to capture the url?
Can this really be done
There are a few options.
Start wireshark (or fiddler) before your Selenium test kicks off. You can do this with a batch file that gets executed in your test setup.
You can utilize a browser plugin for fiddler. IE has one, I'm not sure if there is a comparible plugin for all browsers though. Then you can get Selenium to activate this through the browser...assuming fiddler keeps in the browser window and not open a separate non-browser window that Selenium can't see.UPDATE: Fiddler plugins don't stay in the browser window so this option won't work.
Write some wrapper code that does a driver.Url and stores it into a list. This wrapper code would check to see if the driver.Url is different from the last stored entry in the object and if it is different then it would add it to the list.
All have pros and cons. 3 would give you the most control as your test itself would gather the URL's and maintain a list in code that you can do what you want with. 1 of course would give you the most robust details, depending on how you setup wireshark, and you can profile the entire machine and network experience. 2 is a middle ground where your test still drives it, but the results are separate...but being part of the browser you would have to avoid cleanup after your tests...if you have more tests than one execute at a time this could cause alot of problems...
I made a program, which works fine on my PC without any errors, it also works fine on some office PCs, but it crashes without any describable error on customer's PC and some others.
Crashes are completely random, sometime it may crash and sometimes not.
Crashes are not related with any actions, sometimes it may crash when they just look at the program and wait for crash.
Customers send me this beautiful screens and want me to solve this.
There you see common error reporting dialog, but not info about Exception.
My program uses Unity Web Player running in WebBrowser control. It's always run in background on the hidden tab which becomes visible when needed.
Any ideas how to handle such errors?
I think you should first ensure that the environment at your place and that of your customers are identical.
Maybe there're dll or other programs installed at your place (Unity web player as you mentioned for example) or anything in your Registry that may differ.
Else there's no point in getting error on one PC and not on another.
Make sure all dll are well deployed
Check your registry,
Ensure that all related programs are well installed
So I've been trying to figure out why the application pool keeps crashing every now and then, and I've pinpointed the page that is cau seems to be causing the issue.
When I open the site in the browser, and visit the Shipping cart page (after adding stuff to the cart), the entire browser becomes unresponsive, and I open Task Manager, and see that IE (browser) is using 99% CPU, so I right-click > Create DUMP > Try to read DUMP but WinDBG does not seem to like DMP files; won't read them.
So I move on, and try to figure it out without the dump files. I fire up Visual Studio, open the site in question, and then follow the same process (add stuff to cart, then visit cart page). And to my surprise, everything is OK.
Not sure what to do now. Any suggestions? How would you determine the cause of the hanging, when everything runs perfectly, locally - and when everything used to run perfectly online, but no longer runs fine online?
If the browser becomes unresponsive and eats 99% CPU, that's a client side problem; it most likely doesn't have anything to do with IIS or your server side code.
Could it be that you have some javascript in your page is buggy and goes into a busy loop? I think it's worth a shot to test this (use either IE's developer tools (F12), Visual Studio's javascript debugging functionality, or FireFox in combination with FireBug).
Edit
It strikes me as odd that your AppPool crashes, and in doing so, causes the web browser to turn non-responsive. With non-responsive, do you really mean that the browser itself stops working (i.e. navigating a page back or going to another url such as google.com is impossible?)
Anyway, if you think the problems occur on the server-side, you could try the following things (in order of increasing effort):
After an AppPool crash, check the windows event log (run 'eventvwr' from a command prompt) and see what information that gives you.
View the IIS log (you might have to turn it on first), see if it contains any weird request patterns, such as your page getting hammered)
Run your website from IIS, but attach a debugger from Visual Studio (under Tools, Attach to process - include only managed code) to the IIS worker process (usually w3wp.exe). If your page throws an exception, VS should be able to catch it.
Add more tracing to your page, the Global.asax's Application_Error seems like a particularly good candidate.
I have a Silverlight project that we use internally that I wrote - and since we've not had any need to work on it, it's been a while since I've opened the project. I opened it up this morning and everything is fine in terms of building, but whenever I try to debug I get the following error:
Unable to start program "http://mymachinename/mywebsite/index.aspx"
Of course, running it in Firefox works fine but no symbols are loaded. Running without debugging still throws the same error but IE loads up anyway...
Navigating to the website in IE works fine - SL app opens up, loads data etc etc, all looks good
I've Googled this all morning (usually quite good at finding info) and been through all the questions on SO and I can't figure out what's going on - there doesn't seem to be any messages in the event log, there are no messages in any VS output window, the w3wp just terminates immediately after starting (probably due to there being an error trying to open IE). I've tried reinstalling IE, cleaning/rebuilding, using local dev server, creating a new web project, turning on/off settings in IE9 etc etc
Nothing seems to make a difference - anyone got any experiences of this and has fixed it without doing one of the things I've already done? Any other suggestions?
Thanks in advance!
UPDATE
Just to be clear in case anyone asks - I get this problem when creating a new web project - i.e. everything I said I'd tried (above) didn't change the behaviour. It showed the same error no matter what I'd done so far (that includes a NON SL web project)
I've also tried attaching the debugger to w3wp that is running (the standard IIS process) and I can't seem to get it to debug (no symbols are loading), but that might be another issue altogether. I'm going to look at that next and maybe if I figure that out it might lead to fixing this issue
UPDATE 2
Debugging in Firefox works - I attached to w3wp with no success, then realising my stupidity (SL being a client side app!) I attached to the plugin-container.exe that FF runs its plugins in. This works. I can probably do the same for IE and just attach to IE, but why won't it start up from VS?! hair pull
UPDATE 3
Just in case anyone asks, the default browser is set to IE in VS. Also I've managed to debug by attaching to IE, it just won't start IE from within VS - annoying but I can live with it for now. If anyone does have a suggestion though, feel free...
For anyone's information in case they have this same problem, it ended up being that the port I was running my site on was also running a SharePoint site!
I created a new site on port 81 and used that for dev - not sure what setting on the other site caused the issue but it ended up working on port 81.