If statement problem

To check if visible:

if($w("#text1").isVisible){//put you code here}

to check if exists:

if(typeof $w("#text1").id !== "undefined"){//put you code here}