The state Senate has passed legislation that would allow police to stop and ticket motorists for texting while driving.