Drill-pipe corrosion is a critical issue for any drilling operation, particularly under high-pressure, high-temperature (HPHT) downhole conditions. However, most laboratory studies have been conducted under ambient and static conditions, with only a few downhole studies based on flow loop showing inconsistent results. In this study, we proposed a novel simple method to simulate pipe corrosion/erosion in a reservoir-like environment under both the static and dynamic conditions and investigated the influences of wellbore conditions, including temperature, pressure and salinity of water-based drilling fluids, on the corrosion behaviour of the drill pipe. The results showed that the erosion effect of the drilling fluid (without drilled cuttings) was negligible. Furthermore, we found that the corrosion rate increased with an increase in the temperature, pressure and rotational speed; however, it decreased with an increase in the salinity. In addition, the proposed method can be used to simulate other complicated conditions.