Protractor - Error in Communicating with Remote Browser - Windows Switch - selenium

I am getting Error in Communicating with Remote browser. It may have died when closing an existing browser created by protractor and switching to newly created window and then finding element by Link Text. Below is the code snippet. Kindly help in resolving the issue.
browser.driver.getAllWindowHandles().then(function(handles){
browser.driver.switchTo().window(handles[0]);
browser.driver.close();
browser.driver.switchTo().window(handles[1]);
});
element(by.linkText('connect')).isPresent(); // While Executing This code it throws the above error and Fails...

Related

Selenium webdriver throws Internal server error

In a web application, the browser launched from selenium webdriver throws internal server error.
Manually opening the same web application works fine.
I tried to delete the cookie in the browser launched from driver when I got error and once cookie is cleared and refreshed, I am able to get the application.
I have tried driver.manage().deleteAllCookies() which dint work.
Any suggestions for me please?

WebSocket Connection check fails when running with Testcafe

Using testcafe to test the front end of an Angular Web Application.
The front end uses stomp.js to check whether there is a Websocket connection. If there is no connection, the console will output a 'WebSocket connection to 'ws://localhost:8103/websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED'.
We start a connector process with a batch file and let it run, when we stop the running connector process, the front end displays a message that the connection is lost. (Expected behavior with manual testing)
But whenever we use Testcafe to test the exact same scenario, we don't see the connection lost message. And we also don't see the Websocket connection failed error in the console of the tescafe execution browser. Unless we manually refresh the page in the browser that Testcafe started. Then we will start to see the Websocket connection failed error. It seems that when Testcafe starts a browser, the application is unable to use stomp.js to check whether there is a Websocket connection.
Browser used is Google Chrome version 84.04147.125;
Testcafe version: 1.8.8;
Stomp.js version: 7.2.0;
OS: Windows 10;
Could this be a Testcafe bug?

Is there a bug with Worklight on IE 10?

I've been working with a business partner to get an insurance app working on a Windows 8 tablet and have come across some interesting behavior that I can't explain.
I have managed to recreate the problem using a very simple use case and it appears to fail in the browser as well as when deployed as an app.
To re-create
Create a simple WL Hello World app with no JavaScript libraries
Deploy it to the development server
Open up an IE 10 browser and launch the WL Console.
Run this app using "Preview as Common Resources" and it should work fine (showing the default Hello Worklight)
click F12 to launch the IE debugger and then refresh the browser, click on the show console button to verify there were no errors
Add a WL.Client.connect(...) call into the wlCommonInit method
...
WL.Client.connect({
onSuccess: function(data) {
console.log("connection Successful");
},
onFailure: function(err) {
console.log("Connection FAILED: " + JSON.stringify(err) );
}
});
Save and re-run the app and it fails with an InvalidStateError (verify with F12 debugger)
Open up either a Chrome or Firefox browser to the WL Console page and click the "Preview as Common Resources" and open the developer tools for either and the console shows the connect call succeeding.
Is this a known problem or is there something that I've missed?
The ultimate goal is to deliver a Windows 8.1 tablet app however every time we tried to run the app it failed with this error. After some debugging I thought maybe it has something to do with the OS and tried to replicate it in just the browser with minimum code.
Through testing I've found that the basic Hello Worklight app with a WL.Client.connect() fails on IE but works on other browsers.
So I'm thinking if I get it working in IE browser, then that fix will be good for the tablet app as well.
Any pointers or guidance would be appreciated.
Note I am using WL v6.2 (6.2.0.00-20140915-1601)
Tested on Windows 7 - IE 10.0.9200.17089
Tested on Windows 8.1 - IE 11.0.9600.16663
The error I get is
HTML1300: Navigation occurred.
File: index.html
wlclient init started
before: initOptions.onSuccess
Request [/Connect/apps/services/api/Connect/common/init]
console.trace()
at __log (http://192.168.80.167:10080/Connect/apps/services/preview/Connect/common/0/default/worklight/worklight.js:4882:31)
at Anonymous function (http://192.168.80.167:10080/Connect/apps/services/preview/Connect/common/0/default/worklight/worklight.js:5240:7)
at createRequestHeaders (http://192.168.80.167:10080/Connect/apps/services/preview/Connect/common/0/default/worklight/worklight.js:3200:17)
at sendRequest (http://192.168.80.167:10080/Connect/apps/services/preview/Connect/common/0/default/worklight/worklight.js:3266:18)
at initialize (http://192.168.80.167:10080/Connect/apps/services/preview/Connect/common/0/default/worklight/worklight.js:3172:17)
at klass (http://192.168.80.167:10080/Connect/apps/services/preview/Connect/common/0/default/worklight/worklight.js:524:4)
at sendInitRequest (http://192.168.80.167:10080/Connect/apps/services/preview/Connect/common/0/default/worklight/worklight.js:7870:5)
at connect (http://192.168.80.167:10080/Connect/apps/services/preview/Connect/common/0/default/worklight/worklight.js:7879:3)
SCRIPT5022: InvalidStateError
File: worklight.js, Line: 1055, Column: 3
Uncaught Exception: InvalidStateError at (compiled_code):1055
For future readers, this problem was resolved by moving to a newer fixpack release v6.2.0.00-20141002

Selenium webdriver "Error communicating with remote browser. It may have died" when I run test in parralel

I am working on client side. I have created around 150 test scripts. But during execution, after some script execution, Selenium throws below error and it close the browser. Time is not a fix for this error. It comes when I am executing all the test scripts together in parallel.
The error shows on Google Chrome and Firefox browsers. I am using selenium-server-standalone-2.26.0.jar file and doing execution on FF 13.0.1 version. I have also tried with FF version 14, but I get the same error. My client is not happy with this error because we dont have workaround for this issue.
**Error message:**
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Error communicating with the remote browser. It may have died
I think this will happen when you dealing with popup window.
Example
Working on main window clicking on something leads to open a new popup
switch the control to popup window & do your operations in pop-up
Most of the cases popup will be closed automatically after some action performed in it. (EX : Login with facebook option most of site now a days, after entering user credential no need to close that popup it will be closed automatically after submitting proper credentials)
After this you need to switch the control to main window again otherwise it will throws above exception.
I think your doing some operations without having the control over a window.

handling showModalDialog window in selenium

I am using Selenium- JAVA to automate my application. In my application, when we click on a particular button, it actually opening a window using showModalDialog command. When we open a window using showModalDialog the java-script execution gets suspended till the window gets closed.
Problem No :1
in Internet Explorer(7,8,9), i am getting permission denied error upon clicking. I also tried executing javascript. For this also i got permission denied error. Any idea about this issue?
Problem No:2
In Firefox, i executed the same script and it is working fine. But the problem here is execution is suspended and it will not execute the other commands till the model window gets closed.:( How to solve this issue?
You will have to do modifications in selenium browser bot js-IEBrowserBot.prototype.modifyWindowToRecordPopUpDialogs to handle the modal window-this will help Try this. Or try using webdriver.
Can you post the application HTML you are getting this error on?