Yes, it's possible, but it involves a lot of calculation, and the answer is "it depends".
This article (Beard 2006) discusses theoretical "central transit" durations. A "central transit" is where the planet transits across the middle of the solar disk, which seems like a reasonable instance of your "both planets describe same path on the solar disk" requirement. This takes into account the relative speeds of the Earth and the planet in question and the different possible distances between the Earth, the planet in question, and the Sun.
Since both the Earth and Venus have nearly circular orbits, their speeds and distances at transit can't vary very much, and so the central transit durations range from about 7h45m to 8h09m.
But Mercury's theoretical central transit durations range from 5h21m (when both Earth and Mercury at at perihelion) to 8h18m (when Earth is at perihelion and Mercury is at aphelion) -- spanning both shorter and longer than the Venus transit durations. The main reason is the extreme variation in distances and the fact that Mercury moves much faster at perihelion (orbital velocity $\sim 59$ km/s) than it does at aphelion ($\sim 39$ km/s), because of Mercury's rather elliptical orbit.
As the article mentions, it's technically not possible to have a transits when Earth and the other planet are both at perihelion or both at aphelion, because the orbits are all tilted relative to each other, and their actual orientations prevent simultaneous perihelions/aphelions at the same time as a transit. So Tables 3 and 4 present theoretical central transit durations for the actual orbital positions at the times of some actual Venus and Mercury transits. The result is Venus central transits varying between 7h51m and 7h54m and Mercury central transits varying between 5h27m and 7h54m.