Locating dimmer switch wires is important. Many dimmers need to be loaded a certain way to work properly. Check the wiring diagram for the dimmer that you have purchased. Do you know which wire is the load (Hot)? You don't, great, what do we do now?
Not a big deal use a voltage tester to check which wire is hot. A non contact tester is best. You will have to turn the power back on. Make sure the wire nuts are on the exposed ends of the wires. Got it now? Put a piece of tape on it to tag it for now.
Make sure the switch is in the off position. One wire leading to the switch should be hot with the switch off. The other wire should not have any power. Are both of them hot? Then the switch is not off. Tag the hot wire before you remove the wires. Turn the breaker back off, remember.
One issue with dimmer switches is that they are bigger than normal switches. You may need to push the wires back into the box a little tighter to make room. Did you think that wiring a dimmer switch would not be any work at all?