Looking at this brngs a few questions first!!
Sorry about the slow process but it leads to better answers!
When moving in or out, does the slide seem to stay even left to right as if both motors are working at the same time? If so this would seem to indicate it is not a problem involing only one end, left or right but something common to both. If we go with that idea we can move away from one motor, one set of wires to that motor or most things past the controller!
So what we have left is more likely, the actuator switch or wiring from that switch to the controller as something that is going open and then working again for a bit before going open again??
You may have nailed the problem but it needs some looking/ testing of the switch to try to sort the better idea. This is a switch which is somewhat complex in that it has six wires and six contacts inside. More contacts in smaller space makes it more likely to go bad but the way it mounts can often make it tough to get out of the wall!
Have you worked with this type switch that has "fingers"
or spring type clamps which press in as it is pushed into a mounting hole and then spring out to hold it in?
Not hard to test the switch but getting it out can be a trick! They make it easy to build but hard to get apart if we can't reach the back side to squeeze the fingers in!
This is not the correct switch (too many contacts shown!)but to maybe lead to how to get it out?
If the green lines are a retangle hole cut in the wall, they slide it in the ramps make the fingers compress until they get fully in the wall and then bring back out to clamp the switch in the hole. To get it out without tearing the wall, we need to compress both top and bottom fingers so they will pull out!
Easy enough if we can reach in behind but can be tough to do from the front.
Maybe others know of a good way but I've never found it!!
But once you get the switch out, it can be fairly easy to test. If you happen to have model railroad experience you will recognize this as a "reversing switch"
for the layout!!
Here it is a reversing switch for the motors on the slide!
You should be able to spot the wire ID on the wire labels.
Use this chart to ID each wire if needed:
There should be two wires for 12VDC supplied from switch to controller as I drew going left.
There should be two wires from the battery supply and ground that I've drawn coming in at the right. These may go to the top or bottom set of lugs first, so don't let that throw you as they then are connected but in reverse to the outer lugs on the other end.
The idea is the center two lugs connect to either the top two or the bottom two as we push the switch. If we push it up, the power polarity is one way but pushed down it is reversed as it goes out to the left to the controller and motors.
I've drawn them red and black but I don't know which will be battery and which ground, so don't use my colors as a guide, just to show the idea!!
You "might" be lucky and find one of these wires has a loose push on connector or broken wire but I really suspect you will find the contacts inside for the center lugs is burned and not always making good contact when the switch is pushed.
You may be able to check this if you can push the switch only part way to make the contacts land in a slightly different spot than if fully pushed??
If you have a set of small jumpers, clipping the jumpers on one center and then on the incoming power or ground to bridge around the switch may make it certain that the switch is the problem.
But you can also blow the fuse if you fumble this, so your choice on the value versus the hazard!
I may have told you way more than needed but I'd rather waste your time reading than leave you guessing too far. Sorry about that but we never know what the other folks might already have done!