If you have know just English knowledge, then you can eazly delete this } in shown your error message side
You can’t add break in if condition, you need to return instead of break and remove {} in if conditions
} Error message appears here : Syntax error on token "}", delete this token
Copy past this code instead of your method
public void ok() throws UiObjectNotFoundException
{
//trying to find ok
try{
UiObject okDialog = new UiObject(new UiSelector().text("ok"));
if(okDialog.exists())
System.out.println("Success");
return;//if ok exists it should come out
//if ok not exists
if(!okDialog.exists())
System.out.println("retrying");
getUiDevice().pressHome();
UiObject enterButton = new UiObject(new UiSelector().text("enter"));
enterButton.clickAndWaitForNewWindow();
//validating again to check ok exists
if(okDialog.exists())
return;
else //if ok not exists again printing the belwo message
System.out.println("unable to find");
getUiDevice().pressHome();
//Here if ok not exists after going to home, i want to stop the whole script here..how to do this?
}
catch (UiObjectNotFoundExceptione) {}
}
8
solved Syntax error on token “}” error appears [closed]