By analyzing two sets of complete BVRcIc light curves for V342 UMa and three sets of complete BVRcIc light curves for V509 Cam, we determined that the two systems are both W-subtype contact binaries and that V342 UMa manifests a shallow contact configuration, while V509 Cam exhibits a medium contact configuration. Given that both of them are totally eclipsing binaries, the physical parameters derived only by the photometric light curves are reliable. Meanwhile, the period changes of the two targets were analyzed based on all available eclipsing times. We discovered that V342 UMa shows long-term period decrease with a rate of -1.02(± 0.54) × 10-7 d yr-1 and that V509 Cam displays long-term period increase with a rate of 3.96(± 0.90) × 10-8 d yr-1. Both the conservative mass transfer and angular momentum loss via magnetic stellar winds can be used to interpret the long-term period decrease of V342 UMa. The long-term period increase of V509 Cam can be explained by mass transfer from the less massive star to the more massive one. The absolute parameters of the two binaries were estimated according to their Gaia distances and our derived photometric solution results. This method can be extended to other contact binaries without radial velocities but with reliable photometric solutions. Their evolutionary states were investigated and we found that they reveal properties that are identical to other W-subtype contact systems.