Protractor internet explorer tests unstable - selenium

I have a angular web application that I want to make protractor tests for the page, And I must run the tests with Internet explorer browser.
However, the tests are not stable, sometimes they all work, sometimes few tests fail randomly.
I am having this issue from 1 month now and I still cannot find solution, here what I tried so far:
Running IEwebdriver explicitly in 32bit or 64bit.
Deleting cache and session after every test.
Increased timeouts in conf.js to 200000.
Adding protractor expected conditions(http://www.protractortest.org/#/api?view=ProtractorExpectedConditions)
Making sure using .then after every function that returns promise.
The reasons of tests failing is slowness of internet explorer, and that it waits for element to be clickable(using protractor expectedconditions) but the element is never clickable, and when I look at the webdriver-manager I see that it trying to do the same lines over and over again.
I am sure that my tests are correct and working fine and I am sure that the browser is the problem.
Can you help? Thanks

Related

"element click intercepted" only on TFS

I have about 130 Selenium UI tests for a web app we're currently developing.
The problem I have is, whenever I run the tests locally through Visual Studio's test explorer (vstest), I have never encountered this error before.
The problem is, some of the tests keep failing due to this message when the tests are run on TFS (using vstest on TFS too). element click intercepted
I'm also 100% sure there is no overlaying element that interferes with the click method as the tests never fail with that message when run locally.
Any idea what could this be?
I had issues where all of my local tests would pass, but I would receive random errors as you mentioned when running the tests through Jenkins or TFS, usually errors indicating that my elements were not clickable, etc. - the issue ended up being the browser size.
I started running my test in headless mode and specified a large browser size. Switching to --headless and setting a browser size ended up solving most of my issues for me:
var headlessOptions = new ChromeOptions();
headlessOptions.AddArgument("--headless");
headlessOptions.AddArguments("--disable-gpu");
headlessOptions.AddArguments("--window-size=1920,1200");
You will have to use --headless for this to work too. I tried to run my tests by ONLY setting window size, but the tests would still fail anyway because the resolution of the virtual machines was not large enough to handle the browser size I had set.
You can resolve this issue by using 2 methods.
1.Running chrome in headless mode
2.Scorlling to the element before clicking or interacting with it
The root cause of this issue is due to the fact that the browser does not load with a browser size as that of browser when tested locally
If you intend to run the test in non headless mode you can use the following code to achieve the result.
IWebElement element= driver.FindElement(By.Id(selector));
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", element);

Running Karma with Coverage is failing to shut down Firefox

I am running Karma, Jasmin and Instanbul on Windows 10 and test against ChromeHeadless, FireFoxHeadless and MS-Edge.
The tests all run just fine and the coverage output is written. BUT... Firefox never closes. I get this error:
WARN [launcher]: Firefox was not killed in 2000 ms, sending SIGKILL.
If I don't test with Firefox, everything works fine.
If I don't use coverage, everything works fine.
If I make Firefox non-headless then it still fails in the same way
If I use JUST Firefox then it still fails in the same way
I have spent over 2 weeks trying to find an answer here on StackOverflow and all over the internet. There were similar problems reported but no one ever had a definitive answer related to Firefox and Coverage.
AWESOME!!!!!!! I figured it out.
I asked someone a question and their answer got me thinking about timeouts and I changed the following values in my karma.conf.js file and now it is working:
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 1,
processKillTimeout: 100000,
It seems that the coverage reporting was taking too long and just extending the timeout makes it work fine. The default timeout is 2000ms.
It seems that something related to Firefox takes longer to write out the Firefox coverage files and that was taking longer than 2000ms. This was leading to the error I was seeing.
Increasing the timeout allows everything to be written and Firefox to shut down correctly.

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?

Intern 2.0 test stuck after running client.html page

I have a local selenium server (2.42.2) running with Chromedriver and Firefox. It seems to get stuck after loading and running client.html. I can see that my functional suite code runs in node, far enough to execute the main body. Anything in registerSuite never gets called.
Here are the selenium logs:
http://pastebin.com/KKg5ycvW
I can see the browsers in the selenium sessions page, but they don't appear to be doing anything.
Try opening up a new browser window and paste in the url that you see in the existing selenium ones. Then open up dev tools and see what console errors you are getting.
Intern's runner seems to get stuck in an infinite loop if any uncaught javascript errors are thrown during unit tests if the 'reporter' hasn't been setup yet.
This has been raised as an issue in intern's github repository.