Selenium not allowing non XHR requests - selenium

We have our selenium server (java) which is opening an electron app to test. During our tests, it seems to just lose the program/process control when we make any non XHR request i.e. any TCP request (via tools like serialport) or if we do a DNS lookup for an app. When the execution of such code happens, things just stop working (the code is async and never comes into the try catch block that is enclosing it) and the test fails.
Has anyone seen this type of issue before?

Related

Azure DevOps VSTest,Site Currently unavailable message and times out despite being up

Currently using Selenium + ChromeDriver to execute automated functional tests through Azure DevOps VsTest task but whenever the task tries to execute tests pointing to a website in NetCore, it times out very quickly and sometimes (a lot of times) I get the standard error message from the registered screenshot on error of "This site can't be reached".
I tried running this locally and pointing to the same website but this issue doesn't seem to happen at all and I've got no clue on what's going on due to the big inconsistency between the results that the VsTest task provides.
I also tried opening Chrome on the machine that executes the task but it seems to open the URL fine there.
One thing to note is that the website I'm using uses Windows Authentication mechanism and I'm sending my credentials directly through the URL with https:\\credentialuserexample1:credentialpassexample2#thewebsiteaddress.com and it seems to open the page without issue there too.

Testcafe caught in page reload loop

I have a set of Testcafe tests for our application, which since recently fails to run in some of our environments. The test only opens the browser, loads the start page specified in the fixture (or navigated to in within the test) and then only appears to continuously reload the page without proceeding with the test. This happening across all browsers (Chrome, Firefox, Edge) and different versions of NodeJs and Testcafe on Windows 10.
After enabling debug logging I found this message repeatedly in the log:
{
cmd: 'wait-for-file-download',
sessionId: '0X_DqYtz0'
}
The browser console also showed two page resources/scripts that failed to load with net::ERR_FAILED errors due to violating the Content Security Policy, so I assume that these might cause the problems. However it does not seem to have any impact on manual page interaction or automated test using other frameworks like PyTest.
While we are investigating on the conflicting resources, is there anything I can do in Testcafe to bypass the issue and allow the tests to run? Or alternatively is there a way to fail a Testcafe test when encountering this issue instead of reloading and possibly eventually timing out?

Capture web driver network traffic across all browsers

I want to capture all the network calls from Web Driver in Java. I am not doing any UI testing, just testing JS execution and, requests and responses of some network calls.
I tried using Browser Mob as is suggested in most forums, but I need it to work across all browsers. It worked flawlessly with Firefox, but I was facing some issues with the others. Safari driver doesn't event support a Proxy capability.
I don't want to use Fiddler as it involves some manual steps around invoking and storing the calls. Whereas, Browser Mob being an in-code proxy can be integrated in a more smoother fashion.
I also tried using the RC-like package included in Selenium standalone server package. But, I have some HTTPS calls and some nested iframes in cross domains. I am particularly interested in some cross domain POST call and it doesn't work out that well. Also, people keep saying it's not recommended to use that package.
So, I had a solution where we can use a standalone proxy server running on a machine. Using host entries, we'll point Web Driver to hit the proxy instead of the actual server. The proxy will record all the incoming calls and route them to the actual server host. Later, I can make a request to the proxy which will return me all the calls it intercepted. I am not sure whether it's still called a proxy or a router.
I came across TCPmon, but it's no longer being supported. Does anyone know some similar tools that could run on Unix systems or any alternate solutions?
We modified the Fiddler rules script to include a new exec action. If you use their native script editor, it also provide auto complete features and we were comfortably able to get around it. The syntax is similar to that of JavaScript.
The Fiddler package comes with a ExecActions.exe which can be used to pass console arguments to a running Fiddler instance using the command prompt.
The code we wrote processed all the sessions captured by Fiddler and wrote it to a file in a custom JSON format and later used GSON to deserialize it.
Please let me know, if you want further details.

stopping asynchronous XMLHttpRequest

I have impatient users who update a piece of data on a web page. The update triggers an asynchronous XMLHttpRequest and the response causes the page to update.
My question is this. If the user closes the browser window before the request completes, will the browser send an instruction to the web server to stop the request?
FWIW the users are using Firefox or Safari.
The browser should close the connection, which should result in the server getting a close/fin packet. At that point it is up to the server to decide whether it finishes processing or if it stops processing at that point.
I checked to see if I could find what Apache does, but didn't find any documentation on it.

Does ExceptionHub break Selenium's wait_for_page_to_load command

I just added ExceptionHub (a javascript error tracking service) to our website, but all my selenium tests are failing now. When I look at the selenium output, it says it timed out in waitForPageToLoad command. If I run the test locally, I see that the page loads up fine, so I'm not really sure why selenium keeps waiting. Has anyone else managed to get ExceptionHub working with selenium?
I've seen similar problems with UserVoice. Often the rest of the page is loaded but still waiting for UserVoice and the test will time out.
It might help if you don't start loading ExceptionHub until the rest of the page is loaded. Of course that would mean you can't catch any javascript errors during page load...