In fact, Taylor formula is recommended after the second line: after removing the denominator tanx and x, expand cosx and In( 1+x) with Taylor formula, and the answer will be clear.
In my experience, it is very effective to look at the equivalent infinitesimal first and then use Taylor formula to solve the limit problem. It takes some time to recite the formula, but the idea is simple. It is very troublesome for exponential logarithmic trigonometric functions to appear together, so the polynomial of Taylor formula Huasong X can be added, subtracted, multiplied and divided, but sometimes it is necessary to judge the first few terms of the formula.