Selenium: Stability Issue while running multiple instances of chromedriver on one machine - selenium

I am running multiple instances of google chrome via (chromedriver) on one machine using multi-threading. When I increase the instance count like 12+ (depending of the machine capacity) I start seeing the following issues
Element is visible on the page but the wait command fails randomly even after waiting for long enough. It says the element is not present on the page. The same code always works if I reduce browser count (I also check the server performance issue, there is none)
Click is performed on the element but the action is not triggered. (We can see the element color changed in the screenshot). In another forum, someone said that JS event binding to element is not completed.
I have two questions:
Is it recommended a large number of instances of Google chrome via chromedriver on the machine?
Is there any possible solution for the above problems
Thanks
Vinay

First resize your window.
If you are using Headless browser then you should give a specific size to your browser.
Try to make own xpath and try to use xpaths instead of css selectors.It may prevent unable click or intercept.
Adjust everything in a proper manner of threading.
If CPU and RAM and everything is ok then try to look towards threading pool.
And about your first questing:-
Yes you can definitely use multiple instances on windows machine.It have the capability . But you have to lookafter PORTS using a single instance.Or you can manually use debugger address and set ports like 9992
Hope thease answer will help you definitely.

Related

Is there a reason Selenium could be causing content-length to expand in size?

So I'm using Selenium + ChromeDriver (v93) to do some automations on a form. Usually I have no issue. The form when submitted successfully produces a modal and an XHR on the network side that confirms the deal went through.
Today, I tried my script and dealt with hang time. The XHR was pending, so I tried submitting the form manually without and sure enough it worked just fine. So I check the content-lengths of the XHR requests and I saw it at 233 - reminder this was when I did it manually.
SO - I check the content-lengths of the XHR when using Selenium, same settings, same inputs and the content-lengths boomed in size to 8284883. So I'm like, okay maybe its a size issue and extend my wait time for it to go through. What normally takes ms to finish took a minute.
I'm not too concerned but I'm stuck on what exactly ChromeDriver or Selenium could be doing to increase content-lengths, its just sending an image (in binary), and a few text fields.
I'm just trying to figure out if this is common, or what the story might be. Thanks!

How to debug audio node connections?

I'm working on a large scale music app and I'm having trouble with some nodes not connecting and disconnecting properly.
Is there a method in web audio to see a list of current connections a AudioNode has?
I've tried using Firefox's Developer browser as this shows a view of all current connections but the problem is that it's viewer really can't handle more than about 15 connections.
It would be great if there was something like: osc.connections(); which would return an array of nodes the osc is connected to.
If the Firefox tools doesn't do the trick, then I think the answer is no. I think I saw a Chrome extension which did something similar way back, but I can't find any trace of it.
Your best option is probably to keep track of the connections yourself, unfortunately.

Is there any internal timeout in Microsoft UIAutomation?

I am using the UI Automation COM-to-.NET Adapter to read the contents of the target Google Chrome browser that plays a FLASH content on Windows 7. It works.
I succeeded to get the content and elements. Everything works fine for some time but after few hours the elements become inaccessible.
The (AutomationElement).FindAll() returns 0 children.
Is there any internal undocumented Timeout used by UIAutomation ?
According to this IUIAutomation2 interface
There are 2 timeouts but they are not accessible from IUIAutomation interface.
IUIAutomation2 is supported only on Windows 8 (desktop apps only).
So I believe there is some timeout.
I made a workaround that restarts the searching and monitoring of elements from the beginning of the desktop tree but the elements are still not available.
After some time (not sure how much) the elements are available again.
My requirements are to read the values all the time as fast as possible but this behavior makes a damage to the whole architecture.
I read somewhere that there is some timeout of 3 minutes but not sure.
if there is a timeout, is it possible to change it ?
Is it possible to restart something or release/dispose something ?
I can't find anything on MSDN.
Does anybody have any idea what is happening and how to resolve ?
Thanks for this nicely put question. I have a similar issue with a much different setup. I'm on Win7, using UIAutomationCore.dll directly from C# to test our application-under-development. After running my sequence of actions & event subscriptions and all the other things, I intermittently observe that the UIA interface stops working (about 8-10min in my case, but I'm heavily using the UIA interface).
Many different things including dispatching the COM interface, sleeping at different places failed. The funny revelation was I managed to use the AccEvent.exe (part of SDK like inspect.exe) during the test and saw that events also stopped flowing to AccEvent, too. So it wasn't my client's interface that stopped, but it was rather the COM-server (or whatever the UIAutomationCore does) that stopped responding.
As a solution (that seems to work most of the time - or improve the situation a lot), I decided I should give the application-under-test some breathing point, since using the UIA puts additional load on it. This could be a smartly-put sleep points in your client, but instead of sleeping a set time, I'm monitoring the processor load of the application and waiting until it settles down.
One of the intermittent errors I receive when the problem manifests itself is "... was unable to call any of the subscribers..", and my search resulted in an msdn page saying they have improved things on CUIAutomation8 interface, but as this is Windows8 specific, I didn't have the chance to try that yet.
I should also add that I also reduced the number of calls to UIA by incorporating more ui caching (FindAllBuildCache), as the less the frequency of back-and-forth the better it is for the uia. Thanks to the answer of Guy in another question: UI Automation events stop being received after a while monitoring an application and then restart after some time

Selenium FluentWait wait before starting to poll

I'm using Selenium WebDriver to get some content from a site that dynamically loads it using Ajax. I created a custom Wait class to check for a condition on the page to make sure that the page has loaded before continuing. I used FluentWait to set the polling interval to 2 and timeout to 10. However, I noticed that it checks for the first time at time increment 0, then waits 2 seconds if the condition was false, then checks again, etc.
Since the page takes some time to load, it always is false at the first check, but usually is true at the second. Is there any way to make Wait wait the 2 seconds before checking for the first time? I.e. check at times 2,4,and 6, if necessary, rather than at 0,2,4,and 6?
Thanks,
bsg
EDIT
I've been asked to mention why I want this behavior - after all, I'm using the Wait the way it's meant to be used. The benefit I get from it returning true the first time is the following: WebDriver apparently opens a new socket every time it issues a command to the browser. For whatever reason, these sockets don't always get closed after the call executes. When executing a large number of calls in a short time (for instance, when repeatedly checking for a condition, which is what Wait does), it is possible to run out of virtual sockets, and the driver crashes. (The lack of enough virtual sockets seems to be a known issue on Windows 7, but I can't modify my system.)
The fewer calls to the driver I issue in a short period of time, the less likely it is to overrun the number of available sockets. I have observed that the first check never returns true, and therefore it's just opening a socket for no reason, making the program more likely to crash. That's why I want to wait. I hope this explanation is helpful for someone searching for information as to why they keep getting SocketExceptions in WebDriver.
The obvious answer would be to just insert a time.sleep(2) (or similar method) before your first check. Would that work for what you're trying to do?

What happens when i save a Pharo image while serving http requests?

The Seaside book says: "saving [an image] while processing http requests is a risk you want to avoid“.
Why is this? Does it just temporarily slow down serving http requests or will requests get lost or will errors occur?
Before an image is saved registered shutdown actions are executed. This means source files are closed and web servers are shut down. After the image is saved it executes the startup actions, which typically bring up the web-server again. Depending on the server implementation open connections might be closed.
This means that you cannot accept new connections while you save an image and open connections might be temporarily suspended or closed. For both issues there are (at least) two easy workarounds:
Fork the image using OSProcess before you save it (DabbleDB, CmsBox).
Use multiple images and a load balancer so that you can remove images one at a time from the active servers before saving them.
It seems that it's just a question of slowing things down. There is this quite thorough thread on the Seaside list, the most relevant post of which is this case study of an eCommerce site:
Consequently, currently this is what happens:
image is saved from time to time (usually daily), and copied to a separate "backup" machine.
if anything bad happens, the last image is grabbed, and the orders and/or gift certificates that were issued since the last image save
are simply re-entered.
And, #2 has been very rarely done-- maybe a two or three times a
year, and then it turns out it is usually because I did something
stupid.
Also, one of the great things about Smalltalk is that it's so easy to run quick experiments. You can download Seaside and put a halt in a callback of one of the examples. For example:
WACounter>>renderContentOn: html
...
html anchor
callback: [
self halt.
self increase ];
with: '++'.
...
Open a browser on the Seaside server (port 8080 by default)
Click "Counter" to go to the example app
Click the "++" link
Switch back to Seaside. You'll see the pre-debug window for the halt
Save the image
Click "Proceed"
You'll see that the counter is correctly incremented, with no apparent ill effect from the save.