They are never going to be able to evolve something they dont already have. Like being able to breath out of the water.
Actually, it turns out that lungs evolved even before the swim bladders possessed by most fish. In addition, there are modern fish like blennies that can jump out of the water and gulp air (they hold it in their mouths while the oxygen diffuses through their membranes). Although these guys have swim bladders like other fish, their adaptation allows them to escape predators. There are others, like gar, which gulp air to reinflate their swim bladders. Still others have sacks or specialized alveoli-like protruberances in their stomachs or esophagi - they actually breathe by "eating air".
Since we see all this different kinds of adaptations
today, it's not much of a stretch to understand several ways that a fish-amphibian transition could have taken place way back then. IOW, there's nothing fancy about being able to breathe air for a fish.